pub struct WindowSize {
pub width_dp: f32,
pub height_dp: f32,
pub class: WindowSizeClass,
pub height_class: WindowHeightClass,
}Expand description
The window’s size, as the Renderer last measured it.
width_dp and height_dp are density-independent pixels, the same unit gesture
coordinates use. They are the measurements taken at the moment the class last changed,
not a value that follows every pixel of a drag: a size that changed every layout pass
would run the runtime every layout pass.
Fields§
§width_dp: f32§height_dp: f32§class: WindowSizeClass§height_class: WindowHeightClassImplementations§
Source§impl WindowSize
impl WindowSize
pub const fn new( width_dp: f32, height_dp: f32, class: WindowSizeClass, height_class: WindowHeightClass, ) -> Self
Sourcepub fn is_compact(&self) -> bool
pub fn is_compact(&self) -> bool
Phone-shaped: narrower than 600dp. One column.
Sourcepub fn is_expanded(&self) -> bool
pub fn is_expanded(&self) -> bool
Desktop-shaped: 840dp and wider. Room for a permanent sidebar.
Sourcepub fn is_short(&self) -> bool
pub fn is_short(&self) -> bool
Short: under 480dp tall. A phone lying on its side is the usual one, and a column of stacked sections is what has to fold there.
Sourcepub fn is_medium_height(&self) -> bool
pub fn is_medium_height(&self) -> bool
The ordinary height: 480dp to 900dp.
Trait Implementations§
Source§impl Clone for WindowSize
impl Clone for WindowSize
impl Copy for WindowSize
Source§impl Debug for WindowSize
impl Debug for WindowSize
Source§impl Default for WindowSize
impl Default for WindowSize
Source§impl PartialEq for WindowSize
impl PartialEq for WindowSize
impl StructuralPartialEq for WindowSize
Auto Trait Implementations§
impl Freeze for WindowSize
impl RefUnwindSafe for WindowSize
impl Send for WindowSize
impl Sync for WindowSize
impl Unpin for WindowSize
impl UnsafeUnpin for WindowSize
impl UnwindSafe for WindowSize
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