Skip to main content

InnerHtmlAdapter

Struct InnerHtmlAdapter 

Source
pub struct InnerHtmlAdapter<T> { /* private fields */ }
Expand description

Adapts an inner_html: payload into the matching AttributeValue variant (InnerHtml(String) for static strings, InnerHtmlSignal for Signal<String>).

This is a sibling to AttrValueAdapter specialised for the inner_html: attribute key. The html! macro emits InnerHtmlAdapter::new(expr).into() whenever it sees an inner_html: ... binding, so that inner_html: "raw" and inner_html: my_signal route through set_inner_html rather than the generic set_attribute_or_property path used for ordinary Text attributes.

The actual StringSignal<String> dispatch happens in the From<InnerHtmlAdapter<T>> for AttributeValue impl below, where the trait bounds on T decide which variant is produced.

Implementations§

Source§

impl<T> InnerHtmlAdapter<T>

Source

pub fn new(inner: T) -> Self

Trait Implementations§

Source§

impl<T: Debug> Debug for InnerHtmlAdapter<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<InnerHtmlAdapter<&str>> for AttributeValue

From conversion into AttributeValue.

Source§

fn from(adapter: InnerHtmlAdapter<&str>) -> Self

Wraps the static &str payload by allocating a new String so the renderer owns the data independently of the caller’s borrow lifetime.

§Arguments
  • InnerHtmlAdapter<&str> - Input value to convert from.
Source§

impl From<InnerHtmlAdapter<Signal<String>>> for AttributeValue

From conversion into AttributeValue.

Source§

fn from(adapter: InnerHtmlAdapter<Signal<String>>) -> Self

Wraps the reactive payload in an AttributeValue::InnerHtmlSignal so the renderer subscribes to the signal and re-applies set_inner_html on every change.

§Arguments
  • InnerHtmlAdapter<Signal<String>> - Input value to convert from.
Source§

impl From<InnerHtmlAdapter<String>> for AttributeValue

Adapts an inner_html: payload into the matching AttributeValue variant, routing through set_inner_html instead of the generic Text attribute path.

The two blanket impls below cover the user-visible call sites:

  • String produces AttributeValue::InnerHtml(String::from("...")).
  • Signal<String> produces AttributeValue::InnerHtmlSignal(signal).

Each impl only requires its specific source type, so the compiler picks the right one based on the inferred T at the call site (no manual .into() annotation needed).

Source§

fn from(adapter: InnerHtmlAdapter<String>) -> Self

Wraps the static String payload in an AttributeValue::InnerHtml variant so the renderer can call Element::set_inner_html on it.

§Arguments
  • InnerHtmlAdapter<String> - Input value to convert from.

Auto Trait Implementations§

§

impl<T> Freeze for InnerHtmlAdapter<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for InnerHtmlAdapter<T>
where T: RefUnwindSafe,

§

impl<T> Send for InnerHtmlAdapter<T>
where T: Send,

§

impl<T> Sync for InnerHtmlAdapter<T>
where T: Sync,

§

impl<T> Unpin for InnerHtmlAdapter<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for InnerHtmlAdapter<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for InnerHtmlAdapter<T>
where T: UnwindSafe,

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 = !

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more