From 1ad6251f9a410e8282de99536e92717170765a55 Mon Sep 17 00:00:00 2001 From: Kaede Hoshikawa Date: Thu, 5 Aug 2021 19:29:17 +0900 Subject: [PATCH] Take Cow<'static, str> for class_prefix as well. --- CHANGELOG.md | 6 ++++-- README.md | 6 +++--- src/bindings/yew.rs | 2 -- src/registry.rs | 4 ++-- src/style.rs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbe5463..2e2e30b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,9 @@ - `Style::new()` now takes an `Into>` instead of `Into` and returns `stylist::Error` instead of `String` when encountering an error. -- `Style::create()` now takes `Into>` for css string - and returns `stylist::Error`instead of `String` when encountering an error. +- `Style::create()` now takes `Into>` for class prefix + and css string and returns `stylist::Error`instead of `String` when + encountering an error. - `Style` no longer implements `ToString`. ### Other Changes: @@ -16,6 +17,7 @@ - Styles are now cached by default. - Fixed a Bug where `.a-class-name` is after `@media` would cause parser to return an error. +- Added Docs. - Removed Unnecessary Clones. - Optimised for Performance. diff --git a/README.md b/README.md index 0f89640..04c5c20 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Stylist [![Run Tests & Publishing](https://github.com/futursolo/stylist-rs/actions/workflows/everything.yml/badge.svg)](https://github.com/futursolo/stylist-rs/actions/workflows/everything.yml) - -[![Crates.io](https://img.shields.io/crates/v/stylist)](https://crates.io/crates/stylist) +[![crates.io](https://img.shields.io/crates/v/stylist)](https://crates.io/crates/stylist) +[![docs.rs](https://docs.rs/stylist/badge.svg)](https://docs.rs/stylist/) Stylist is a CSS-in-Rust styling solution for WebAssembly Applications. @@ -13,7 +13,7 @@ This is a fork of [css-in-rust](https://github.com/lukidoescode/css-in-rust). Add the following to your `Cargo.toml`: ```toml -stylist = "0.6" +stylist = "0.7" ``` ## Usage diff --git a/src/bindings/yew.rs b/src/bindings/yew.rs index 6f381c0..92390db 100644 --- a/src/bindings/yew.rs +++ b/src/bindings/yew.rs @@ -1,6 +1,4 @@ //! Yew integration module. -//! The user doesn't need to do anything but to put a style into the class of a -//! yew component. use crate::Style; use yew::html::Classes; diff --git a/src/registry.rs b/src/registry.rs index b18aaa9..18aa73d 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -7,11 +7,11 @@ use once_cell::sync::Lazy; use crate::Style; #[derive(Debug, Clone, PartialEq, Hash, Eq)] -pub(crate) struct StyleKey(pub String, pub Cow<'static, str>); +pub(crate) struct StyleKey(pub Cow<'static, str>, pub Cow<'static, str>); impl PartialEq<(&str, &str)> for StyleKey { fn eq(&self, other: &(&str, &str)) -> bool { - &(self.0.as_str(), &*self.1) == other + &(&*self.0, &*self.1) == other } } diff --git a/src/style.rs b/src/style.rs index e457d6f..9525057 100644 --- a/src/style.rs +++ b/src/style.rs @@ -157,7 +157,7 @@ impl Style { /// /// let style = Style::create("my-component", "color:red;").expect("Failed to create style."); /// ``` - pub fn create, I2: Into>>( + pub fn create>, I2: Into>>( class_prefix: I1, css: I2, ) -> Result {