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 strThe text to be displayed in this TextBox
bounds: RectangleThe bounding box of this TextBox
character_style: SThe character style of the TextBox.
style: TextBoxStyleThe style of the TextBox.
vertical_offset: i32Vertical offset applied to the text just before rendering.
Implementations
impl<'a, S> TextBox<'a, S, NoPlugin<<S as TextRenderer>::Color>> where
<S as TextRenderer>::Color: From<Rgb888>,
S: TextRenderer + CharacterStyle,
impl<'a, S> TextBox<'a, S, NoPlugin<<S as TextRenderer>::Color>> where
<S as TextRenderer>::Color: From<Rgb888>,
S: TextRenderer + CharacterStyle, Creates a new TextBox instance with a given bounding Rectangle.
pub fn with_textbox_style(
text: &'a str,
bounds: Rectangle,
character_style: S,
textbox_style: TextBoxStyle
) -> Self
pub fn with_textbox_style(
text: &'a str,
bounds: Rectangle,
character_style: S,
textbox_style: TextBoxStyle
) -> SelfCreates a new TextBox instance with a given bounding Rectangle and a given TextBoxStyle.
pub fn with_alignment(
text: &'a str,
bounds: Rectangle,
character_style: S,
alignment: HorizontalAlignment
) -> Self
pub fn with_alignment(
text: &'a str,
bounds: Rectangle,
character_style: S,
alignment: HorizontalAlignment
) -> SelfCreates a new TextBox instance with a given bounding Rectangle and a given TextBoxStyle.
pub fn with_vertical_alignment(
text: &'a str,
bounds: Rectangle,
character_style: S,
vertical_alignment: VerticalAlignment
) -> Self
pub fn with_vertical_alignment(
text: &'a str,
bounds: Rectangle,
character_style: S,
vertical_alignment: VerticalAlignment
) -> SelfCreates 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.
Trait Implementations
impl<'a, S, M> Dimensions for TextBox<'a, S, M> where
S: TextRenderer,
M: Plugin<'a, S::Color>,
impl<'a, S, M> Dimensions for TextBox<'a, S, M> where
S: TextRenderer,
M: Plugin<'a, S::Color>, Returns the bounding box.
impl<'a, F, M> Drawable for TextBox<'a, F, M> where
F: TextRenderer<Color = <F as CharacterStyle>::Color> + CharacterStyle,
<F as CharacterStyle>::Color: From<Rgb888>,
M: Plugin<'a, <F as TextRenderer>::Color> + Plugin<'a, <F as CharacterStyle>::Color>,
impl<'a, F, M> Drawable for TextBox<'a, F, M> where
F: TextRenderer<Color = <F as CharacterStyle>::Color> + CharacterStyle,
<F as CharacterStyle>::Color: From<Rgb888>,
M: Plugin<'a, <F as TextRenderer>::Color> + Plugin<'a, <F as CharacterStyle>::Color>, Auto Trait Implementations
impl<'a, S, M = NoPlugin<<S as TextRenderer>::Color>> !RefUnwindSafe for TextBox<'a, S, M>impl<'a, S, M = NoPlugin<<S as TextRenderer>::Color>> !Sync for TextBox<'a, S, M>impl<'a, S, M> Unpin for TextBox<'a, S, M> where
M: Unpin,
S: Unpin,
<S as TextRenderer>::Color: Unpin, impl<'a, S, M> UnwindSafe for TextBox<'a, S, M> where
M: UnwindSafe,
S: UnwindSafe,
<S as TextRenderer>::Color: UnwindSafe, Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
type Output = T
type Output = TShould always be Self
Casts the value.
Casts the value.
Casts the value.