Skip to main content

InnerHtmlValue

Trait InnerHtmlValue 

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

    // Required methods
    fn html_len(&self) -> usize;
    fn to_html(self, buf: &mut String);
    fn to_template(buf: &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;
}
Expand description

A possible value for InnerHtml.

Required Associated Types§

Source

type AsyncOutput: InnerHtmlValue

The type after all async data have resolved.

Source

type State

The view state retained between building and rebuilding.

Source

type Cloneable: InnerHtmlValue + Clone

An equivalent value that can be cloned.

Source

type CloneableOwned: InnerHtmlValue + 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, buf: &mut String)

Renders the class to HTML.

Source

fn to_template(buf: &mut String)

Renders the class to HTML for a <template>.

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.

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 InnerHtmlValue 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, buf: &mut String)

Source§

fn to_template(_buf: &mut String)

Source§

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

Source§

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

Source§

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

Source§

fn into_cloneable(self) -> Self::Cloneable

Source§

fn into_cloneable_owned(self) -> Self::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve(self) -> Self::AsyncOutput

Source§

impl InnerHtmlValue for String

Source§

type AsyncOutput = String

Source§

type State = (Element, String)

Source§

type Cloneable = Arc<str>

Source§

type CloneableOwned = Arc<str>

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, buf: &mut String)

Source§

fn to_template(_buf: &mut String)

Source§

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

Source§

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

Source§

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

Source§

fn into_cloneable(self) -> Self::Cloneable

Source§

fn into_cloneable_owned(self) -> Self::Cloneable

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve(self) -> Self::AsyncOutput

Source§

impl InnerHtmlValue 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, buf: &mut String)

Source§

fn to_template(_buf: &mut String)

Source§

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

Source§

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

Source§

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

Source§

fn into_cloneable(self) -> Self::Cloneable

Source§

fn into_cloneable_owned(self) -> Self::Cloneable

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve(self) -> Self::AsyncOutput

Source§

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

Source§

type AsyncOutput = Option<T>

Source§

type State = (Element, Option<<T as InnerHtmlValue>::State>)

Source§

type Cloneable = Option<<T as InnerHtmlValue>::Cloneable>

Source§

type CloneableOwned = Option<<T as InnerHtmlValue>::CloneableOwned>

Source§

fn html_len(&self) -> usize

Source§

fn to_html(self, buf: &mut String)

Source§

fn to_template(_buf: &mut String)

Source§

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

Source§

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

Source§

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

Source§

fn into_cloneable(self) -> Self::Cloneable

Source§

fn into_cloneable_owned(self) -> Self::CloneableOwned

Source§

fn dry_resolve(&mut self)

Source§

async fn resolve(self) -> Self::AsyncOutput

Implementors§