Struct kas_text::Text

source ·
pub struct Text<T: FormattableText + ?Sized> { /* private fields */ }
Expand description

Text, prepared for display in a given environment

This struct is composed of three parts: an Environment, a representation of the FormattableText being displayed, and a TextDisplay object.

Most Functionality is implemented via the TextApi and TextApiExt traits.

Implementations§

Construct from a text model

This struct must be made ready for usage by calling Text::prepare.

Construct from a text model and environment

This struct must be made ready for usage by calling Text::prepare.

Clone the formatted text

Extract text object, discarding the rest

Access the formattable text object

Set the text

One must call Text::prepare afterwards and may wish to inspect its return value to check the size allocation meets requirements.

Set the text and prepare (if any fonts are loaded)

Sets text regardless of other outcomes.

If fonts are not loaded, this fails fast (see fonts::any_loaded), unlike other preparation methods.

Returns true if at least some action is performed and the text exceeds the allocated bounds (Environment::bounds).

Trait Implementations§

Converts this type into a mutable reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Insert a char at the given position Read more
Replace a section of text Read more
Set text to a raw String Read more
Swap the raw text with a String Read more
Read the TextDisplay
Access whole text as contiguous str Read more
Clone the unformatted text as a String
Read the environment
Set the environment Read more
Require an action Read more
Prepare text runs Read more
Measure required width, up to some limit Read more
Measure required vertical height, wrapping as configured Read more
Prepare text for display, as necessary Read more
Get the sequence of effect tokens Read more
Length of text Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Cast from Self to T Read more
Try converting from Self to T Read more
Try approximate conversion from Self to T Read more
Cast approximately from Self to T Read more
Cast to integer, truncating Read more
Cast to the nearest integer Read more
Cast the floor to an integer Read more
Cast the ceiling to an integer Read more
Try converting to integer with truncation Read more
Try converting to the nearest integer Read more
Try converting the floor to an integer Read more
Try convert the ceiling to an integer Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.