Struct finestra::Label

source ·
pub struct Label<State = ()> { /* private fields */ }
Expand description

A View that displays text.

let label = Label::new("This is some text");
let label = Label::new(format!("What is 2 + 2? Correct, {}!", 2 + 2));

Implementations§

source§

impl<State> Label<State>

source

pub fn new(text: impl Into<StateOrRaw<String>>) -> Self

Creates a new Label with the associated string.

source

pub fn with_color(self, color: impl Into<StateOrRaw<Color>>) -> Self

Returns Self with the given color.

source

pub fn with_background_color(self, color: impl Into<StateOrRaw<Color>>) -> Self

Returns Self with the given background color.

source

pub fn set_color(&mut self, color: impl Into<StateOrRaw<Color>>)

Sets the color of the Label. Use Label::with_color() to avoid making a mut variable.

source

pub fn set_background_color(&mut self, color: impl Into<StateOrRaw<Color>>)

Sets the background color of the Label. Use Label::with_background_color() to avoid making a mut variable.

Trait Implementations§

source§

impl<Delegate, State> From<Label<State>> for Box<dyn View<Delegate, State>>
where Delegate: AppDelegate<State> + 'static, State: 'static,

source§

fn from(value: Label<State>) -> Self

Converts to this type from the input type.
source§

impl<Delegate, State: 'static> View<Delegate, State> for Label<State>
where Delegate: AppDelegate<State>,

source§

fn build_native(&mut self, tree: &mut ViewTree<State>, parent: HWND) -> WinView

Internal API: creates a native view (for Win32).

Auto Trait Implementations§

§

impl<State = ()> !RefUnwindSafe for Label<State>

§

impl<State = ()> !Send for Label<State>

§

impl<State = ()> !Sync for Label<State>

§

impl<State> Unpin for Label<State>

§

impl<State = ()> !UnwindSafe for Label<State>

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> BaseViewExt for T
where T: BaseView,

source§

fn set_tooltip(&mut self, tooltip: impl Into<StateOrRaw<String>>)

Set the tooltip of the view, which is text that is commonly displayed when hovering over a component (such as a button). This is used to provide the user with more context, or to let them know what the action will do.
source§

fn with_tooltip(self, tooltip: impl Into<StateOrRaw<String>>) -> T

Set the tooltip of the view, which is text that is commonly displayed when hovering over a component (such as a button). This is used to provide the user with more context, or to let them know what the action will do.
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.