Struct LabeledTextArea

Source
pub struct LabeledTextArea<'a> { /* private fields */ }
Expand description

Labeled Text Area

A variant of TextArea that adds a themed block around the text area and a reactive header with a title, an optional subtitle, and an optional twitter-like character count.

Implementationsยง

Sourceยง

impl<'a> LabeledTextArea<'a>

Source

pub fn new(th: LabeledTextAreaTheme) -> Self

Create a new LabeledTextArea with the given LabeledTextAreaTheme.

Source

pub fn with_validations( self, validations: impl IntoIterator<Item = impl Fn(&str) -> Result<(), String> + Send + Sync + 'static>, ) -> Self

Source

pub fn is_valid(&self) -> bool

Source

pub fn validate(&mut self) -> ValidationResult

Source

pub fn set_active(&mut self, active: bool)

Set the text area to be active or not.

Source

pub fn is_active(&self) -> bool

Get the active status of the text area.

Source

pub fn with_title(self, title: impl Into<String>) -> Self

Set the title of the text area.

Source

pub fn with_subtitle(self, subtitle: impl Into<String>) -> Self

Set the subtitle of the text area.

Source

pub fn with_active(self, active: bool) -> Self

Set the active status of the text area.

Source

pub fn with_max_char_count(self, max_char_count: usize) -> Self

Set the maximum character count for the text area.

Source

pub fn set_max_char_count(&mut self, max_char_count: usize)

Set the maximum character count for the text area.

Source

pub fn with_single_line(self, single_line: bool) -> Self

Set the text area to be single line or not.

Source

pub fn lines(&'a self) -> &'a [String]

Get the text area lines.

Source

pub fn text(&self) -> String

Get the text area text.

Source

pub fn char_count(&self) -> usize

Source

pub fn input(&mut self, input: impl Into<Input>) -> bool

Source

pub fn get_rect(&self, area: Rect) -> Rect

Source

pub fn get_height(&self) -> u16

Source

pub fn is_touched(&self) -> bool

Get the touched status of the text area.

A text area is considered touched if it has been active at least once. This is useful to know if the user has interacted with the text area.

Trait Implementationsยง

Sourceยง

impl<'a> Clone for LabeledTextArea<'a>

Sourceยง

fn clone(&self) -> LabeledTextArea<'a>

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<'a> Default for LabeledTextArea<'a>

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl Widget for &LabeledTextArea<'_>

Sourceยง

fn render(self, area: Rect, buf: &mut Buffer)

Draws the current state of the widget in the given buffer. That is the only method required to implement a custom widget.

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> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> Downcast for T
where T: Any,

Sourceยง

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Anyโ€™s vtable from &Traitโ€™s.
Sourceยง

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Anyโ€™s vtable from &mut Traitโ€™s.
Sourceยง

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Sourceยง

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

impl<T> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.