Skip to content

Commit

Permalink
Take Cow<'static, str> for class_prefix as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
futursolo committed Aug 5, 2021
1 parent 2df2803 commit 1ad6251
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
- `Style::new()` now takes an `Into<Cow<'static, str>>` instead of
`Into<String>` and returns `stylist::Error` instead of `String` when
encountering an error.
- `Style::create()` now takes `Into<Cow<'static, str>>` for css string
and returns `stylist::Error`instead of `String` when encountering an error.
- `Style::create()` now takes `Into<Cow<'static, str>>` for class prefix
and css string and returns `stylist::Error`instead of `String` when
encountering an error.
- `Style` no longer implements `ToString`.

### Other Changes:
Expand All @@ -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.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/bindings/yew.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl Style {
///
/// let style = Style::create("my-component", "color:red;").expect("Failed to create style.");
/// ```
pub fn create<I1: Into<String>, I2: Into<Cow<'static, str>>>(
pub fn create<I1: Into<Cow<'static, str>>, I2: Into<Cow<'static, str>>>(
class_prefix: I1,
css: I2,
) -> Result<Self> {
Expand Down

0 comments on commit 1ad6251

Please sign in to comment.