Enum leptos_dom::Class

source ·
pub enum Class {
    Value(bool),
    Fn(Box<dyn Fn() -> bool>),
}
Expand description

Represents the different possible values a single class on an element could have, allowing you to do fine-grained updates to single items in Element.classList.

This mostly exists for the view macro’s use. You usually won’t need to interact with it directly.

Variants§

§

Value(bool)

Whether the class is present.

§

Fn(Box<dyn Fn() -> bool>)

A (presumably reactive) function, which will be run inside an effect to toggle the class.

Implementations§

Converts the class to its HTML value at that moment so it can be rendered on the server.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.