Skip to main content

TextNodeContent

Trait TextNodeContent 

Source
pub trait TextNodeContent {
    // Required methods
    fn mount_text_content(self, ctx: &mut Context, style: Style) -> NodeId;
    fn mount_text_current(self, 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.
Source

fn mount_text_current(self, style: Style) -> NodeId

Mounts this static or reactive text payload into the ambient Context without cloning Context.

§Arguments
  • Self - Text value or reactive producer closure.
  • 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§

fn mount_text_current(self, style: Style) -> NodeId

Mounts a static text scene node from this &String using the ambient Context without cloning it.

§Arguments
  • Self - Borrowed string reference.
  • 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§

fn mount_text_current(self, style: Style) -> NodeId

Mounts a static text scene node from this &str using the ambient Context without cloning it.

§Arguments
  • Self - Borrowed text slice.
  • 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§

fn mount_text_current(self, style: Style) -> NodeId

Mounts a static text scene node from this Cow<str> using the ambient Context without cloning it.

§Arguments
  • Self - Copy-on-write string value.
  • 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.
Source§

fn mount_text_current(self, style: Style) -> NodeId

Mounts a static text scene node from this String using the ambient Context without cloning it.

§Arguments
  • Self - Owned text string.
  • 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.