Struct embedded_text::TextBox

source ·
pub struct TextBox<'a> {
    pub text: &'a str,
    pub bounds: Rectangle,
}
Expand description

A piece of text with an associated area on the display

Fields§

§text: &'a str

The text to be displayed in this TextBox

§bounds: Rectangle

The bounding box of this TextBox

Implementations§

source§

impl<'a> TextBox<'a>

source

pub fn new(text: &'a str, bounds: Rectangle) -> Self

Creates a new TextBox instance with a given bounding box.

source

pub fn into_styled<C, F, A>( self, style: TextBoxStyle<C, F, A>, ) -> StyledTextBox<'a, C, F, A>
where C: PixelColor, F: Font + Copy, A: TextAlignment,

Attaches a textbox style to the textbox object.

Trait Implementations§

source§

impl Dimensions for TextBox<'_>

source§

fn top_left(&self) -> Point

Get the top left corner of the bounding box for an object
source§

fn bottom_right(&self) -> Point

Get the bottom right corner of the bounding box for an object
source§

fn size(&self) -> Size

Get the width and height for an object
source§

impl Transform for TextBox<'_>

source§

fn translate(&self, by: Point) -> Self

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

fn translate_mut(&mut self, by: Point) -> &mut Self

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

Auto Trait Implementations§

§

impl<'a> Freeze for TextBox<'a>

§

impl<'a> RefUnwindSafe for TextBox<'a>

§

impl<'a> Send for TextBox<'a>

§

impl<'a> Sync for TextBox<'a>

§

impl<'a> Unpin for TextBox<'a>

§

impl<'a> UnwindSafe for TextBox<'a>

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<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>,

§

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>,

§

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.