Trait druid::text::TextStorage

source ·
pub trait TextStorage: PietTextStorage + Data {
    // Provided methods
    fn add_attributes(
        &self,
        builder: PietTextLayoutBuilder,
        env: &Env
    ) -> PietTextLayoutBuilder { ... }
    fn env_update(&self, ctx: &EnvUpdateCtx<'_, '_>) -> bool { ... }
    fn links(&self) -> &[Link] { ... }
}
Expand description

A type that represents text that can be displayed.

Provided Methods§

source

fn add_attributes( &self, builder: PietTextLayoutBuilder, env: &Env ) -> PietTextLayoutBuilder

If this TextStorage object manages style spans, it should implement this method and update the provided builder with its spans, as required.

Examples found in repository?
examples/text.rs (line 54)
53
54
55
    fn add_attributes(&self, builder: PietTextLayoutBuilder, env: &Env) -> PietTextLayoutBuilder {
        self.text.add_attributes(builder, env)
    }
source

fn env_update(&self, ctx: &EnvUpdateCtx<'_, '_>) -> bool

This is called whenever the Env changes and should return true if the layout should be rebuilt.

Any additional Link attributes on this text.

If this TextStorage object manages link attributes, it should implement this method and return any attached Links.

Unlike other attributes, links are managed in Druid, not in piet; as such they require a separate API.

Implementations on Foreign Types§

source§

impl TextStorage for String

source§

impl TextStorage for Arc<String>

Implementors§