pub enum Length {
Cells(u16),
Fill(NonZeroU16),
}Expand description
A box dimension: an absolute size, or a share of the remaining area.
Every length measures the box the terminal shows — content plus padding
plus enabled border edges — with margin outside it. u16 converts into
Length::Cells, so width(20) stays concise.
Variants§
Cells(u16)
An absolute number of terminal cells.
Fill(NonZeroU16)
A weighted share of the area remaining to the box’s siblings.
Implementations§
Source§impl Length
impl Length
Sourcepub const fn fill(weight: u16) -> Self
pub const fn fill(weight: u16) -> Self
Creates a weighted share of the area remaining to the box’s siblings.
Use Length::try_fill when weight comes from input that may be
zero.
§Panics
Panics if weight is zero.
Sourcepub const fn try_fill(weight: u16) -> Result<Self, InvalidFillWeight>
pub const fn try_fill(weight: u16) -> Result<Self, InvalidFillWeight>
Tries to create a weighted share of the remaining area.
Trait Implementations§
impl Copy for Length
impl Eq for Length
impl StructuralPartialEq for Length
Auto Trait Implementations§
impl Freeze for Length
impl RefUnwindSafe for Length
impl Send for Length
impl Sync for Length
impl Unpin for Length
impl UnsafeUnpin for Length
impl UnwindSafe for Length
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more