Skip to main content

MixedText

Struct MixedText 

Source
pub struct MixedText { /* private fields */ }
Expand description

MixedText is a component that renders a text string containing a mix of styles.

If you want to render a text string with a single style, use the Text component instead.

§Example

element! {
    View(
        border_style: BorderStyle::Round,
        border_color: Color::Blue,
        width: 30,
    ) {
        MixedText(align: TextAlign::Center, contents: vec![
            MixedTextContent::new("Hello, world!").color(Color::Red).weight(Weight::Bold),
            MixedTextContent::new(" Lorem ipsum odor amet, consectetuer adipiscing elit.").color(Color::Green),
        ])
    }
}

Trait Implementations§

Source§

impl Component for MixedText

Source§

type Props<'a> = MixedTextProps

The type of properties that the component accepts.
Source§

fn new(_props: &Self::Props<'_>) -> Self

Creates a new instance of the component from a set of properties.
Source§

fn update( &mut self, props: &mut Self::Props<'_>, _hooks: Hooks<'_, '_>, updater: &mut ComponentUpdater<'_, '_, '_>, )

Invoked whenever the properties of the component or layout may have changed.
Source§

fn draw(&mut self, drawer: &mut ComponentDrawer<'_>)

Invoked to draw the component.
Source§

fn poll_change(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<()>

Invoked to determine whether a change has occurred that would require the component to be updated and redrawn.
Source§

impl Default for MixedText

Source§

fn default() -> MixedText

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<C> ElementType for C
where C: Component,

Source§

type Props<'a> = <C as Component>::Props<'a>

The type of the properties that can be passed to the element.
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 = Infallible

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.