leptos::tachys::html::class

Trait IntoClass

Source
pub trait IntoClass: Send {
    type AsyncOutput: IntoClass;
    type State;
    type Cloneable: IntoClass + Clone;
    type CloneableOwned: IntoClass + Clone + 'static;

    const TEMPLATE: &'static str = "";
    const MIN_LENGTH: usize = _;

    // Required methods
    fn html_len(&self) -> usize;
    fn to_html(self, class: &mut String);
    fn hydrate<const FROM_SERVER: bool>(self, el: &Element) -> Self::State;
    fn build(self, el: &Element) -> Self::State;
    fn rebuild(self, state: &mut Self::State);
    fn into_cloneable(self) -> Self::Cloneable;
    fn into_cloneable_owned(self) -> Self::CloneableOwned;
    fn dry_resolve(&mut self);
    fn resolve(self) -> impl Future<Output = Self::AsyncOutput> + Send;
    fn reset(state: &mut Self::State);

    // Provided method
    fn to_template(class: &mut String) { ... }
}
Expand description

A possible value for a CSS class.

Provided Associated Constants§

Source

const TEMPLATE: &'static str = ""

The HTML that should be included in a <template>.

Source

const MIN_LENGTH: usize = _

The minimum length of the HTML.

Required Associated Types§

Source

type AsyncOutput: IntoClass

The type after all async data have resolved.

Source

type State

The view state retained between building and rebuilding.

Source

type Cloneable: IntoClass + Clone

An equivalent value that can be cloned.

Source

type CloneableOwned: IntoClass + Clone + 'static

An equivalent value that can be cloned and is 'static.

Required Methods§

Source

fn html_len(&self) -> usize

The estimated length of the HTML.

Source

fn to_html(self, class: &mut String)

Renders the class to HTML.

Source

fn hydrate<const FROM_SERVER: bool>(self, el: &Element) -> Self::State

Adds interactivity as necessary, given DOM nodes that were created from HTML that has either been rendered on the server, or cloned for a <template>.

Source

fn build(self, el: &Element) -> Self::State

Adds this class to the element during client-side rendering.

Source

fn rebuild(self, state: &mut Self::State)

Updates the value.

Source

fn into_cloneable(self) -> Self::Cloneable

Converts this to a cloneable type.

Source

fn into_cloneable_owned(self) -> Self::CloneableOwned

Converts this to a cloneable, owned type.

Source

fn dry_resolve(&mut self)

“Runs” the attribute without other side effects. For primitive types, this is a no-op. For reactive types, this can be used to gather data about reactivity or about asynchronous data that needs to be loaded.

Source

fn resolve(self) -> impl Future<Output = Self::AsyncOutput> + Send

“Resolves” this into a type that is not waiting for any asynchronous data.

Source

fn reset(state: &mut Self::State)

Reset the class list to the state before this class was added.

Provided Methods§

Source

fn to_template(class: &mut String)

Renders the class to HTML for a <template>.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl IntoClass for &str

Source§

type AsyncOutput = &str

Source§

type State = (Element, &str)

Source§

type Cloneable = &str

Source§

type CloneableOwned = Arc<str>

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <&str as IntoClass>::State

Source§

fn build(self, el: &Element) -> <&str as IntoClass>::State

Source§

fn rebuild(self, state: &mut <&str as IntoClass>::State)

Source§

fn into_cloneable(self) -> <&str as IntoClass>::Cloneable

Source§

fn into_cloneable_owned(self) -> <&str as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve(self) -> <&str as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <&str as IntoClass>::State)

Source§

impl IntoClass for (&'static str, bool)

Source§

type AsyncOutput = (&'static str, bool)

Source§

type State = (DomTokenList, bool, &'static str)

Source§

type Cloneable = (&'static str, bool)

Source§

type CloneableOwned = (&'static str, bool)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, bool) as IntoClass>::State

Source§

fn build(self, el: &Element) -> <(&'static str, bool) as IntoClass>::State

Source§

fn rebuild(self, state: &mut <(&'static str, bool) as IntoClass>::State)

Source§

fn into_cloneable(self) -> <(&'static str, bool) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned(self) -> <(&'static str, bool) as IntoClass>::Cloneable

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve(self) -> <(&'static str, bool) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, bool) as IntoClass>::State)

Source§

impl IntoClass for (&'static str, ArcMemo<bool>)
where ArcMemo<bool>: Get<Value = bool>,

Source§

type AsyncOutput = (&'static str, ArcMemo<bool>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, ArcMemo<bool>)

Source§

type CloneableOwned = (&'static str, ArcMemo<bool>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, ArcMemo<bool>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, ArcMemo<bool>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, ArcMemo<bool>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, ArcMemo<bool>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, ArcMemo<bool>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, ArcMemo<bool>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, ArcMemo<bool>) as IntoClass>::State)

Source§

impl IntoClass for (&'static str, ArcReadSignal<bool>)
where ArcReadSignal<bool>: Get<Value = bool>,

Source§

type AsyncOutput = (&'static str, ArcReadSignal<bool>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, ArcReadSignal<bool>)

Source§

type CloneableOwned = (&'static str, ArcReadSignal<bool>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, ArcReadSignal<bool>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, ArcReadSignal<bool>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, ArcReadSignal<bool>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, ArcReadSignal<bool>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, ArcReadSignal<bool>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, ArcReadSignal<bool>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, ArcReadSignal<bool>) as IntoClass>::State)

Source§

impl IntoClass for (&'static str, ArcRwSignal<bool>)
where ArcRwSignal<bool>: Get<Value = bool>,

Source§

type AsyncOutput = (&'static str, ArcRwSignal<bool>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, ArcRwSignal<bool>)

Source§

type CloneableOwned = (&'static str, ArcRwSignal<bool>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, ArcRwSignal<bool>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, ArcRwSignal<bool>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, ArcRwSignal<bool>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, ArcRwSignal<bool>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, ArcRwSignal<bool>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, ArcRwSignal<bool>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, ArcRwSignal<bool>) as IntoClass>::State)

Source§

impl IntoClass for (&'static str, ArcSignal<bool>)
where ArcSignal<bool>: Get<Value = bool>,

Source§

type AsyncOutput = (&'static str, ArcSignal<bool>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, ArcSignal<bool>)

Source§

type CloneableOwned = (&'static str, ArcSignal<bool>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, ArcSignal<bool>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, ArcSignal<bool>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, ArcSignal<bool>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, ArcSignal<bool>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, ArcSignal<bool>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, ArcSignal<bool>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, ArcSignal<bool>) as IntoClass>::State)

Source§

impl IntoClass for String

Source§

impl IntoClass for Arc<str>

Source§

type AsyncOutput = Arc<str>

Source§

type State = (Element, Arc<str>)

Source§

type Cloneable = Arc<str>

Source§

type CloneableOwned = Arc<str>

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <Arc<str> as IntoClass>::State

Source§

fn build(self, el: &Element) -> <Arc<str> as IntoClass>::State

Source§

fn rebuild(self, state: &mut <Arc<str> as IntoClass>::State)

Source§

fn into_cloneable(self) -> <Arc<str> as IntoClass>::Cloneable

Source§

fn into_cloneable_owned(self) -> <Arc<str> as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve(self) -> <Arc<str> as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <Arc<str> as IntoClass>::State)

Source§

impl<F, T> IntoClass for (&'static str, F)
where F: ReactiveFunction<Output = T>, T: Borrow<bool> + Send + 'static,

Source§

type AsyncOutput = (&'static str, bool)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, Arc<Mutex<dyn FnMut() -> T + Send>>)

Source§

type CloneableOwned = (&'static str, Arc<Mutex<dyn FnMut() -> T + Send>>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, F) as IntoClass>::State

Source§

fn build(self, el: &Element) -> <(&'static str, F) as IntoClass>::State

Source§

fn rebuild(self, state: &mut <(&'static str, F) as IntoClass>::State)

Source§

fn into_cloneable(self) -> <(&'static str, F) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, F) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve(self) -> <(&'static str, F) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, F) as IntoClass>::State)

Source§

impl<S> IntoClass for (&'static str, MaybeSignal<bool, S>)
where MaybeSignal<bool, S>: Get<Value = bool>, S: Send + 'static + Storage<bool>,

Source§

type AsyncOutput = (&'static str, MaybeSignal<bool, S>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, MaybeSignal<bool, S>)

Source§

type CloneableOwned = (&'static str, MaybeSignal<bool, S>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, MaybeSignal<bool, S>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, MaybeSignal<bool, S>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, MaybeSignal<bool, S>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, MaybeSignal<bool, S>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, MaybeSignal<bool, S>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, MaybeSignal<bool, S>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, MaybeSignal<bool, S>) as IntoClass>::State)

Source§

impl<S> IntoClass for (&'static str, Memo<bool, S>)
where Memo<bool, S>: Get<Value = bool>, S: Send + 'static + Storage<bool>,

Source§

type AsyncOutput = (&'static str, Memo<bool, S>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, Memo<bool, S>)

Source§

type CloneableOwned = (&'static str, Memo<bool, S>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, Memo<bool, S>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, Memo<bool, S>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, Memo<bool, S>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, Memo<bool, S>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, Memo<bool, S>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, Memo<bool, S>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, Memo<bool, S>) as IntoClass>::State)

Source§

impl<S> IntoClass for (&'static str, ReadSignal<bool, S>)
where ReadSignal<bool, S>: Get<Value = bool>, S: Send + 'static + Storage<bool>,

Source§

type AsyncOutput = (&'static str, ReadSignal<bool, S>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, ReadSignal<bool, S>)

Source§

type CloneableOwned = (&'static str, ReadSignal<bool, S>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, ReadSignal<bool, S>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, ReadSignal<bool, S>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, ReadSignal<bool, S>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, ReadSignal<bool, S>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, ReadSignal<bool, S>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, ReadSignal<bool, S>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, ReadSignal<bool, S>) as IntoClass>::State)

Source§

impl<S> IntoClass for (&'static str, RwSignal<bool, S>)
where RwSignal<bool, S>: Get<Value = bool>, S: Send + 'static + Storage<bool>,

Source§

type AsyncOutput = (&'static str, RwSignal<bool, S>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, RwSignal<bool, S>)

Source§

type CloneableOwned = (&'static str, RwSignal<bool, S>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, RwSignal<bool, S>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, RwSignal<bool, S>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, RwSignal<bool, S>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, RwSignal<bool, S>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, RwSignal<bool, S>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, RwSignal<bool, S>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, RwSignal<bool, S>) as IntoClass>::State)

Source§

impl<S> IntoClass for (&'static str, Signal<bool, S>)
where Signal<bool, S>: Get<Value = bool>, S: Send + 'static + Storage<bool>,

Source§

type AsyncOutput = (&'static str, Signal<bool, S>)

Source§

type State = RenderEffectWithClassName<(DomTokenList, bool)>

Source§

type Cloneable = (&'static str, Signal<bool, S>)

Source§

type CloneableOwned = (&'static str, Signal<bool, S>)

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, class: &mut String)

Source§

fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(&'static str, Signal<bool, S>) as IntoClass>::State

Source§

fn build( self, el: &Element, ) -> <(&'static str, Signal<bool, S>) as IntoClass>::State

Source§

fn rebuild( self, state: &mut <(&'static str, Signal<bool, S>) as IntoClass>::State, )

Source§

fn into_cloneable( self, ) -> <(&'static str, Signal<bool, S>) as IntoClass>::Cloneable

Source§

fn into_cloneable_owned( self, ) -> <(&'static str, Signal<bool, S>) as IntoClass>::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve( self, ) -> <(&'static str, Signal<bool, S>) as IntoClass>::AsyncOutput

Source§

fn reset(state: &mut <(&'static str, Signal<bool, S>) as IntoClass>::State)

Source§

impl<T> IntoClass for Option<T>
where T: IntoClass,

Implementors§

Source§

impl IntoClass for Oco<'static, str>

Source§

type AsyncOutput = Oco<'static, str>

Source§

type State = (Element, Oco<'static, str>)

Source§

type Cloneable = Oco<'static, str>

Source§

type CloneableOwned = Oco<'static, str>

Source§

impl<C> IntoClass for ArcMemo<C>
where ArcMemo<C>: Get<Value = C>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<C> IntoClass for ArcReadSignal<C>
where ArcReadSignal<C>: Get<Value = C>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<C> IntoClass for ArcRwSignal<C>
where ArcRwSignal<C>: Get<Value = C>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<C> IntoClass for ArcSignal<C>
where ArcSignal<C>: Get<Value = C>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<C, S> IntoClass for MaybeSignal<C, S>
where MaybeSignal<C, S>: Get<Value = C>, S: Send + Sync + 'static + Storage<C> + Storage<Option<C>>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<C, S> IntoClass for Memo<C, S>
where Memo<C, S>: Get<Value = C>, S: Send + Sync + 'static + Storage<C> + Storage<Option<C>>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<C, S> IntoClass for ReadSignal<C, S>
where ReadSignal<C, S>: Get<Value = C>, S: Send + Sync + 'static + Storage<C> + Storage<Option<C>>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<C, S> IntoClass for RwSignal<C, S>
where RwSignal<C, S>: Get<Value = C>, S: Send + Sync + 'static + Storage<C> + Storage<Option<C>>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<C, S> IntoClass for Signal<C, S>
where Signal<C, S>: Get<Value = C>, S: Send + Sync + 'static + Storage<C> + Storage<Option<C>>, C: IntoClass + Send + Sync + Clone + 'static, <C as IntoClass>::State: 'static,

Source§

impl<F, C> IntoClass for F
where F: ReactiveFunction<Output = C>, C: IntoClass + 'static, <C as IntoClass>::State: 'static,