TextFieldLineLimits

Enum TextFieldLineLimits 

Source
pub enum TextFieldLineLimits {
    SingleLine,
    MultiLine {
        min_lines: usize,
        max_lines: usize,
    },
}
Expand description

Line limit configuration for text fields.

Controls whether a text field allows multiple lines of input and how many lines are visible at minimum and maximum.

§SingleLine

When SingleLine is used:

  • Newline characters (\n) are blocked from input
  • Pasted text has newlines replaced with spaces
  • The text field scrolls horizontally if content exceeds width
  • The Enter key does NOT insert a newline (may trigger submit action)

§MultiLine

When MultiLine is used:

  • Newline characters are allowed
  • The text field scrolls vertically if content exceeds visible lines
  • min_lines controls minimum visible height (default: 1)
  • max_lines controls maximum visible height before scrolling (default: unlimited)

§Example

use cranpose_foundation::text::TextFieldLineLimits;

// Single-line text field (like a search box)
let single = TextFieldLineLimits::SingleLine;

// Multi-line with default settings
let multi = TextFieldLineLimits::default();

// Multi-line with 3-5 visible lines
let constrained = TextFieldLineLimits::MultiLine { min_lines: 3, max_lines: 5 };

Variants§

§

SingleLine

Single line input - no newlines allowed, horizontal scrolling.

§

MultiLine

Multi-line input with optional line constraints.

  • min_lines: Minimum number of visible lines (affects minimum height)
  • max_lines: Maximum number of visible lines before scrolling

Fields

§min_lines: usize

Minimum visible lines (default: 1)

§max_lines: usize

Maximum visible lines before scrolling (default: unlimited)

Implementations§

Source§

impl TextFieldLineLimits

Source

pub const DEFAULT: Self

Default multi-line with no constraints (1 line minimum, unlimited maximum).

Source

pub fn is_single_line(&self) -> bool

Returns true if this is single-line mode.

Source

pub fn is_multi_line(&self) -> bool

Returns true if this is multi-line mode.

Source

pub fn min_lines(&self) -> usize

Returns the minimum number of lines (1 for SingleLine).

Source

pub fn max_lines(&self) -> usize

Returns the maximum number of lines (1 for SingleLine, configured value for MultiLine).

Trait Implementations§

Source§

impl Clone for TextFieldLineLimits

Source§

fn clone(&self) -> TextFieldLineLimits

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 Debug for TextFieldLineLimits

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TextFieldLineLimits

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TextFieldLineLimits

Source§

fn eq(&self, other: &TextFieldLineLimits) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TextFieldLineLimits

Source§

impl Eq for TextFieldLineLimits

Source§

impl StructuralPartialEq for TextFieldLineLimits

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