pub trait IntoStyle: Send {
type AsyncOutput: IntoStyle;
type State;
type Cloneable: IntoStyle + Clone;
type CloneableOwned: IntoStyle + Clone + 'static;
// Required methods
fn to_html(self, style: &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);
}
Expand description
Any type that can be added to the style
attribute or set as a style in
the CssStyleDeclaration
.
This could be a plain string, or a property name-value pair.
Required Associated Types§
Sourcetype AsyncOutput: IntoStyle
type AsyncOutput: IntoStyle
The type after all async data have resolved.
Sourcetype CloneableOwned: IntoStyle + Clone + 'static
type CloneableOwned: IntoStyle + Clone + 'static
An equivalent value that can be cloned and is 'static
.
Required Methods§
Sourcefn hydrate<const FROM_SERVER: bool>(self, el: &Element) -> Self::State
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>
.
Sourcefn build(self, el: &Element) -> Self::State
fn build(self, el: &Element) -> Self::State
Adds this style to the element during client-side rendering.
Sourcefn into_cloneable(self) -> Self::Cloneable
fn into_cloneable(self) -> Self::Cloneable
Converts this to a cloneable type.
Sourcefn into_cloneable_owned(self) -> Self::CloneableOwned
fn into_cloneable_owned(self) -> Self::CloneableOwned
Converts this to a cloneable, owned type.
Sourcefn dry_resolve(&mut self)
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.
Sourcefn resolve(self) -> impl Future<Output = Self::AsyncOutput> + Send
fn resolve(self) -> impl Future<Output = Self::AsyncOutput> + Send
“Resolves” this into a type that is not waiting for any asynchronous data.
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 IntoStyle for (Arc<str>, Arc<str>)
impl IntoStyle for (Arc<str>, Arc<str>)
Source§fn reset(state: &mut <(Arc<str>, Arc<str>) as IntoStyle>::State)
fn reset(state: &mut <(Arc<str>, Arc<str>) as IntoStyle>::State)
Reset the renderer to the state before this style was added.
type AsyncOutput = (Arc<str>, Arc<str>)
type State = (CssStyleDeclaration, Arc<str>, Arc<str>)
type Cloneable = (Arc<str>, Arc<str>)
type CloneableOwned = (Arc<str>, Arc<str>)
fn to_html(self, style: &mut String)
fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <(Arc<str>, Arc<str>) as IntoStyle>::State
fn build(self, el: &Element) -> <(Arc<str>, Arc<str>) as IntoStyle>::State
fn rebuild(self, state: &mut <(Arc<str>, Arc<str>) as IntoStyle>::State)
fn into_cloneable(self) -> <(Arc<str>, Arc<str>) as IntoStyle>::Cloneable
fn into_cloneable_owned(self) -> <(Arc<str>, Arc<str>) as IntoStyle>::Cloneable
fn dry_resolve(&mut self)
async fn resolve(self) -> <(Arc<str>, Arc<str>) as IntoStyle>::AsyncOutput
Source§impl IntoStyle for String
impl IntoStyle for String
type AsyncOutput = String
type State = (Element, String)
type Cloneable = Arc<str>
type CloneableOwned = Arc<str>
fn to_html(self, style: &mut String)
fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <String as IntoStyle>::State
fn build(self, el: &Element) -> <String as IntoStyle>::State
fn rebuild(self, state: &mut <String as IntoStyle>::State)
fn into_cloneable(self) -> <String as IntoStyle>::Cloneable
fn into_cloneable_owned(self) -> <String as IntoStyle>::CloneableOwned
fn dry_resolve(&mut self)
async fn resolve(self) -> <String as IntoStyle>::AsyncOutput
fn reset(state: &mut <String as IntoStyle>::State)
Source§impl IntoStyle for Arc<str>
impl IntoStyle for Arc<str>
type AsyncOutput = Arc<str>
type State = (Element, Arc<str>)
type Cloneable = Arc<str>
type CloneableOwned = Arc<str>
fn to_html(self, style: &mut String)
fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <Arc<str> as IntoStyle>::State ⓘ
fn build(self, el: &Element) -> <Arc<str> as IntoStyle>::State ⓘ
fn rebuild(self, state: &mut <Arc<str> as IntoStyle>::State)
fn into_cloneable(self) -> <Arc<str> as IntoStyle>::Cloneable ⓘ
fn into_cloneable_owned(self) -> <Arc<str> as IntoStyle>::CloneableOwned ⓘ
fn dry_resolve(&mut self)
async fn resolve(self) -> <Arc<str> as IntoStyle>::AsyncOutput ⓘ
fn reset(state: &mut <Arc<str> as IntoStyle>::State)
Source§impl<'a> IntoStyle for &'a str
impl<'a> IntoStyle for &'a str
type AsyncOutput = &'a str
type State = (Element, &'a str)
type Cloneable = &'a str
type CloneableOwned = Arc<str>
fn to_html(self, style: &mut String)
fn hydrate<const FROM_SERVER: bool>( self, el: &Element, ) -> <&'a str as IntoStyle>::State
fn build(self, el: &Element) -> <&'a str as IntoStyle>::State
fn rebuild(self, state: &mut <&'a str as IntoStyle>::State)
fn into_cloneable(self) -> <&'a str as IntoStyle>::Cloneable
fn into_cloneable_owned(self) -> <&'a str as IntoStyle>::CloneableOwned
fn dry_resolve(&mut self)
async fn resolve(self) -> <&'a str as IntoStyle>::AsyncOutput
fn reset(state: &mut <&'a str as IntoStyle>::State)
Source§impl<'a> IntoStyle for (&'a str, &'a str)
impl<'a> IntoStyle for (&'a str, &'a str)
Source§fn reset(state: &mut <(&'a str, &'a str) as IntoStyle>::State)
fn reset(state: &mut <(&'a str, &'a str) as IntoStyle>::State)
Reset the renderer to the state before this style was added.