LabelWidget

Struct LabelWidget 

Source
pub struct LabelWidget { /* private fields */ }
Expand description
§Description

A basic text widget. It can be single lined if your text fits within the width of the widget or it canbe multilined if your text exceeds it and its height is greater than 1

Implementations§

Source§

impl LabelWidget

Source

pub fn new( x: i32, y: i32, max_width: u32, max_height: u32, text: &str, ) -> Rc<RefCell<Self>>

§Description

Creates a new label

§Arguments
  • x: i32 - The x position of the label
  • y: i32 - The y position of the label
  • max_width: i32 - The maximum width of the label
  • max_height: i32 - The maximum height of the label
  • text: &str - The text to be shown on the label
§Returns

Rc<RefCell<LabelWidget>> - A newly created label widget

Source

pub fn set_text(&mut self, new_text: &str)

§Description

Sets the text of the label

§Arguments
  • new_text: &str - The text to set the label to
Source

pub fn get_text(&mut self) -> String

§Description

Gets the current text of the label

§Returns

String - The text of the label

Trait Implementations§

Source§

impl Widget for LabelWidget

Source§

fn draw( &mut self, positioning_algorithm: &Box<dyn PositioningAlgorithm>, display_buffer: &mut DisplayBuffer, )

Description Read more
Source§

fn get_bounding_box(&self) -> BoundingBox

Description Read more

Auto Trait Implementations§

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

Source§

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

Source§

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.