Skip to main content

TextNodeContent

Trait TextNodeContent 

Source
pub trait TextNodeContent {
    // Required method
    fn mount_text_content(self, ctx: &mut Context, style: Style) -> NodeId;
}
Expand description

Polymorphic text payload trait mounted by view! text { { expr } } supporting both static strings and reactive closures without emitting consumer-scope imports.

Required Methods§

Source

fn mount_text_content(self, ctx: &mut Context, style: Style) -> NodeId

Mounts this static or reactive text payload into ctx with style.

§Arguments
  • Self - Text value or reactive producer closure.
  • &mut Context - Active scene build context.
  • Style - Resolved text style.
§Returns
  • NodeId - Mounted text scene node handle.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TextNodeContent for &String

TextNodeContent implementation mounting a borrowed &String as a static text node.

Source§

fn mount_text_content(self, ctx: &mut Context, style: Style) -> NodeId

Mounts a static text scene node from this &String.

§Arguments
  • Self - Borrowed string reference.
  • &mut Context - Active scene build context.
  • Style - Resolved text style.
§Returns
  • NodeId - Mounted text node handle.
Source§

impl TextNodeContent for &str

TextNodeContent implementation mounting a string slice as a static text node.

Source§

fn mount_text_content(self, ctx: &mut Context, style: Style) -> NodeId

Mounts a static text scene node from this &str.

§Arguments
  • Self - Borrowed text slice.
  • &mut Context - Active scene build context.
  • Style - Resolved text style.
§Returns
  • NodeId - Mounted text node handle.
Source§

impl TextNodeContent for Cow<'_, str>

TextNodeContent implementation mounting a Cow<str> as a static text node.

Source§

fn mount_text_content(self, ctx: &mut Context, style: Style) -> NodeId

Mounts a static text scene node from this Cow<str>.

§Arguments
  • Self - Copy-on-write string value.
  • &mut Context - Active scene build context.
  • Style - Resolved text style.
§Returns
  • NodeId - Mounted text node handle.
Source§

impl TextNodeContent for String

TextNodeContent implementation mounting an owned String as a static text node.

Source§

fn mount_text_content(self, ctx: &mut Context, style: Style) -> NodeId

Mounts a static text scene node from this String.

§Arguments
  • Self - Owned text string.
  • &mut Context - Active scene build context.
  • Style - Resolved text style.
§Returns
  • NodeId - Mounted text node handle.

Implementors§

Source§

impl<F, S> TextNodeContent for F
where F: FnMut() -> S + 'static, S: Into<String>,

TextNodeContent implementation mounting any FnMut() -> S closure or function item as a reactive text node.