Struct Css

Source
pub struct Css { /* private fields */ }
Expand description

Css struct allows to reference the stylesheet selectors from appended stylesheet inside the rsx macro.

In order to referecne a selector from the stylesheet use the indexing operator with the name of the selector as an argument.

§Example usage

use wal_css::css:Css;
use wal_css::css_stylesheet;

thread_local! {
    static CSS: Css = css_stylesheet!("path-to-css-file");
}
// ...
CSS.with(|css| {
    rsx! {
        <div class={format!("{} {}", css["class1"], css["class2"])} />
    }
})

Trait Implementations§

Source§

impl Index<&str> for Css

Source§

fn index(&self, index: &str) -> &Self::Output

Indexing operator for accessing prepended selectors by original selector names

Source§

type Output = String

The returned type after indexing.

Auto Trait Implementations§

§

impl Freeze for Css

§

impl RefUnwindSafe for Css

§

impl !Send for Css

§

impl !Sync for Css

§

impl Unpin for Css

§

impl UnwindSafe for Css

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.