pub struct Padding {
pub left: u16,
pub right: u16,
pub top: u16,
pub bottom: u16,
}
Expand description
Defines the padding for a Block
.
See the padding
method of Block
to configure its padding.
This concept is similar to CSS padding.
NOTE: Terminal cells are often taller than they are wide, so to make horizontal and vertical padding seem equal, doubling the horizontal padding is usually pretty good.
§Example
use ratatui::widgets::Padding;
Padding::uniform(1);
Padding::horizontal(2);
Padding::left(3);
Padding::proportional(4);
Padding::symmetric(5, 6);
Fields§
§left: u16
Left padding
right: u16
Right padding
top: u16
Top padding
bottom: u16
Bottom padding
Implementations§
Source§impl Padding
impl Padding
Sourcepub const fn new(left: u16, right: u16, top: u16, bottom: u16) -> Self
pub const fn new(left: u16, right: u16, top: u16, bottom: u16) -> Self
Creates a new Padding
by specifying every field individually.
Note: the order of the fields does not match the order of the CSS properties.
Sourcepub const fn zero() -> Self
👎Deprecated: use Padding::ZERO
pub const fn zero() -> Self
Creates a Padding
with all fields set to 0
.
Sourcepub const fn horizontal(value: u16) -> Self
pub const fn horizontal(value: u16) -> Self
Creates a Padding
with the same value for left
and right
.
Sourcepub const fn vertical(value: u16) -> Self
pub const fn vertical(value: u16) -> Self
Creates a Padding
with the same value for top
and bottom
.
Sourcepub const fn proportional(value: u16) -> Self
pub const fn proportional(value: u16) -> Self
Creates a Padding
that is visually proportional to the terminal.
This represents a padding of 2x the value for left
and right
and 1x the value for
top
and bottom
.
Trait Implementations§
Source§impl Ord for Padding
impl Ord for Padding
Source§impl PartialOrd for Padding
impl PartialOrd for Padding
impl Copy for Padding
impl Eq for Padding
impl StructuralPartialEq for Padding
Auto Trait Implementations§
impl Freeze for Padding
impl RefUnwindSafe for Padding
impl Send for Padding
impl Sync for Padding
impl Unpin for Padding
impl UnwindSafe for Padding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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