pub struct SizeClass {
pub width: WidthClass,
pub height: HeightClass,
}Expand description
A window’s size class (docs/size-classes.md), reported by the backend and read by apps
through day::size_class().
Per-window, not per-app: two windows of one process can sit in different classes at the same time (a narrow and a wide window side by side, iPadOS Stage Manager, Android split-screen), and an app that keyed off a single global would lay the second window out for the first one’s size.
Fields§
§width: WidthClass§height: HeightClassImplementations§
Source§impl SizeClass
impl SizeClass
Sourcepub const SPLIT_MIN_WIDTH: f64 = 600.0
pub const SPLIT_MIN_WIDTH: f64 = 600.0
The Compact/Medium width boundary in dp: the narrowest window where a second
pane starts to fit. Backends that hand an adaptive container its pane widths derive
them from this (Android’s list + minimum-detail widths sum to it), so the platform’s
measure-time decision and this table agree by construction (docs/size-classes.md).
Sourcepub fn from_size(width: f64, height: f64) -> SizeClass
pub fn from_size(width: f64, height: f64) -> SizeClass
Bucket a window’s size in points. The one place the breakpoint numbers appear.
Sourcepub fn prefers_split(self) -> bool
pub fn prefers_split(self) -> bool
Whether a two-pane presentation fits. The rule behind an automatic
props::NavPresentation: anything wider than compact gets both panes.
Trait Implementations§
impl Copy for SizeClass
impl Eq for SizeClass
impl StructuralPartialEq for SizeClass
Auto Trait Implementations§
impl Freeze for SizeClass
impl RefUnwindSafe for SizeClass
impl Send for SizeClass
impl Sync for SizeClass
impl Unpin for SizeClass
impl UnsafeUnpin for SizeClass
impl UnwindSafe for SizeClass
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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