pub struct WindowMetrics {
pub size: Size,
pub scale: f64,
pub orientation: Orientation,
pub insets: WindowInsets,
}Expand description
The window’s shape, flat-re-exported from frust-core::app so app code
(not just widget authors, see authoring::WindowMetrics) can recover it
via use_context::<WindowMetrics>() inside Component::build — a
component laying itself out around window size/scale/orientation reads
this the same way it reads a Theme via use_context. Delivered as a
plain value (not an RwSignal); see WindowMetrics’s own doc for the
derived-Orientation and rebuild-cost notes.
The window’s logical size, device-pixel scale, derived Orientation and WindowInsets,
as a plain provide_context value: use_context subscribes to nothing, so a changed value is
visible only on the next rebuild. Re-provide it only on change, beside the standalone insets.
Fields§
§size: SizeThe window’s logical (density-independent) size.
scale: f64The device-pixel scale factor (logical → physical px multiplier).
orientation: OrientationDerived from size; no platform callback carries an orientation.
insets: WindowInsetsImplementations§
Source§impl WindowMetrics
impl WindowMetrics
Sourcepub fn new(size: Size, scale: f64, insets: WindowInsets) -> WindowMetrics
pub fn new(size: Size, scale: f64, insets: WindowInsets) -> WindowMetrics
Construct a WindowMetrics, deriving orientation from size.
Trait Implementations§
Source§impl Clone for WindowMetrics
impl Clone for WindowMetrics
Source§fn clone(&self) -> WindowMetrics
fn clone(&self) -> WindowMetrics
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for WindowMetrics
Source§impl Debug for WindowMetrics
impl Debug for WindowMetrics
Source§impl PartialEq for WindowMetrics
impl PartialEq for WindowMetrics
impl StructuralPartialEq for WindowMetrics
Auto Trait Implementations§
impl Freeze for WindowMetrics
impl RefUnwindSafe for WindowMetrics
impl Send for WindowMetrics
impl Sync for WindowMetrics
impl Unpin for WindowMetrics
impl UnsafeUnpin for WindowMetrics
impl UnwindSafe for WindowMetrics
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.