Struct embedded_text::TextBox[][src]

pub struct TextBox<'a, S, M = NoPlugin<<S as TextRenderer>::Color>> where
    S: TextRenderer
{ pub text: &'a str, pub bounds: Rectangle, pub character_style: S, pub style: TextBoxStyle, pub vertical_offset: i32, // some fields omitted }
Expand description

A text box object.

The TextBox struct represents a piece of text that can be drawn on a display inside the given bounding box.

Use the draw method to draw the text box on a display.

See the module-level documentation for more information.

Fields

text: &'a str

The text to be displayed in this TextBox

bounds: Rectangle

The bounding box of this TextBox

character_style: S

The character style of the TextBox.

style: TextBoxStyle

The style of the TextBox.

vertical_offset: i32

Vertical offset applied to the text just before rendering.

Implementations

Creates a new TextBox instance with a given bounding Rectangle.

Creates a new TextBox instance with a given bounding Rectangle and a given TextBoxStyle.

Creates a new TextBox instance with a given bounding Rectangle and a given TextBoxStyle.

Creates a new TextBox instance with a given bounding Rectangle and a given TextBoxStyle.

Sets the vertical text offset.

Sets the height of the TextBox to the height of the text.

Sets the height of the TextBox to the height of the text, limited to max_height.

This method allows you to set a maximum height. The TextBox will take up at most max_height pixel vertical space.

Trait Implementations

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 bounding box.

The pixel color type.

The return type of the draw method. Read more

Draw the graphics object using the supplied DrawTarget.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Move the origin of an object by a given number of (x, y) pixels, returning a new object

Move the origin of an object by a given number of (x, y) pixels, mutating the object in place Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Performs the conversion.

Performs the conversion.

Casts the value.

Should always be Self

Casts the value.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.

Casts the value.

Casts the value.