pub struct NativeSize<P> {
pub width: P,
pub height: P,
}Expand description
A size represented in the platform’s native pixels.
This size is represented in physical pixels on Windows and Linux, and in logical pixels on macOS.
(This is a re-implementation of
baseview::dpi::NativeSize
to avoid directly depending on baseview until it is stabilized.)
Fields§
§width: P§height: PImplementations§
Source§impl<P> NativeSize<P>
impl<P> NativeSize<P>
pub const fn new(width: P, height: P) -> NativeSize<P>
Source§impl<P> NativeSize<P>where
P: Pixel,
impl<P> NativeSize<P>where
P: Pixel,
pub fn from_size(size: Size, scale_factor: f64) -> NativeSize<P>
pub fn from_logical_or_physical( logical_size: LogicalSize<f64>, physical_size: PhysicalSize<u32>, ) -> NativeSize<P>
pub fn cast<X>(&self) -> NativeSize<X>where
X: Pixel,
pub fn to_physical(self, scale_factor: f64) -> PhysicalSize<P>
pub fn to_logical(self, scale_factor: f64) -> LogicalSize<P>
Trait Implementations§
Source§impl<P> Clone for NativeSize<P>where
P: Clone,
impl<P> Clone for NativeSize<P>where
P: Clone,
Source§fn clone(&self) -> NativeSize<P>
fn clone(&self) -> NativeSize<P>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<P> Copy for NativeSize<P>where
P: Copy,
Source§impl<P> Debug for NativeSize<P>where
P: Debug,
impl<P> Debug for NativeSize<P>where
P: Debug,
impl<P> Eq for NativeSize<P>where
P: Eq,
Source§impl<P> From<NativeSize<P>> for Sizewhere
P: Pixel,
impl<P> From<NativeSize<P>> for Sizewhere
P: Pixel,
Source§fn from(size: NativeSize<P>) -> Size
fn from(size: NativeSize<P>) -> Size
Converts to this type from the input type.
Source§impl<P> Hash for NativeSize<P>where
P: Hash,
impl<P> Hash for NativeSize<P>where
P: Hash,
Source§impl<P> PartialEq for NativeSize<P>where
P: PartialEq,
impl<P> PartialEq for NativeSize<P>where
P: PartialEq,
impl<P> StructuralPartialEq for NativeSize<P>where
P: PartialEq,
Auto Trait Implementations§
impl<P> Freeze for NativeSize<P>where
P: Freeze,
impl<P> RefUnwindSafe for NativeSize<P>where
P: RefUnwindSafe,
impl<P> Send for NativeSize<P>where
P: Send,
impl<P> Sync for NativeSize<P>where
P: Sync,
impl<P> Unpin for NativeSize<P>where
P: Unpin,
impl<P> UnsafeUnpin for NativeSize<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for NativeSize<P>where
P: UnwindSafe,
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