pub struct Breakpoints {
pub sm: u16,
pub md: u16,
pub lg: u16,
pub xl: u16,
}Expand description
Breakpoint thresholds for responsive layouts.
Each field is the minimum width (in terminal columns) for that breakpoint. Xs implicitly starts at width 0.
Fields§
§sm: u16Minimum width for Sm.
md: u16Minimum width for Md.
lg: u16Minimum width for Lg.
xl: u16Minimum width for Xl.
Implementations§
Source§impl Breakpoints
impl Breakpoints
Sourcepub const fn new(sm: u16, md: u16, lg: u16) -> Self
pub const fn new(sm: u16, md: u16, lg: u16) -> Self
Create breakpoints with explicit thresholds.
Values are sanitized to be monotonically non-decreasing.
Sourcepub const fn new_with_xl(sm: u16, md: u16, lg: u16, xl: u16) -> Self
pub const fn new_with_xl(sm: u16, md: u16, lg: u16, xl: u16) -> Self
Create breakpoints with all four explicit thresholds.
Values are sanitized to be monotonically non-decreasing.
Sourcepub const fn classify_width(self, width: u16) -> Breakpoint
pub const fn classify_width(self, width: u16) -> Breakpoint
Classify a width into a breakpoint bucket.
Sourcepub const fn classify_size(self, size: Size) -> Breakpoint
pub const fn classify_size(self, size: Size) -> Breakpoint
Classify a Size (uses width).
Sourcepub const fn at_least(self, width: u16, min: Breakpoint) -> bool
pub const fn at_least(self, width: u16, min: Breakpoint) -> bool
Check if width is at least a given breakpoint.
Sourcepub const fn between(self, width: u16, min: Breakpoint, max: Breakpoint) -> bool
pub const fn between(self, width: u16, min: Breakpoint, max: Breakpoint) -> bool
Check if width is between two breakpoints (inclusive).
Sourcepub const fn threshold(self, bp: Breakpoint) -> u16
pub const fn threshold(self, bp: Breakpoint) -> u16
Get the minimum width threshold for a given breakpoint.
Sourcepub const fn thresholds(self) -> [(Breakpoint, u16); 5]
pub const fn thresholds(self) -> [(Breakpoint, u16); 5]
Get all thresholds as (Breakpoint, min_width) pairs.
Trait Implementations§
Source§impl Clone for Breakpoints
impl Clone for Breakpoints
Source§fn clone(&self) -> Breakpoints
fn clone(&self) -> Breakpoints
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Breakpoints
impl Debug for Breakpoints
Source§impl PartialEq for Breakpoints
impl PartialEq for Breakpoints
impl Copy for Breakpoints
impl Eq for Breakpoints
impl StructuralPartialEq for Breakpoints
Auto Trait Implementations§
impl Freeze for Breakpoints
impl RefUnwindSafe for Breakpoints
impl Send for Breakpoints
impl Sync for Breakpoints
impl Unpin for Breakpoints
impl UnwindSafe for Breakpoints
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