#[repr(C)]pub struct LogicalSize {
pub width: f32,
pub height: f32,
}Expand description
A 2D size in logical (DPI-independent) coordinates.
Fields§
§width: f32§height: f32Implementations§
Source§impl LogicalSize
impl LogicalSize
Sourcepub fn scale_for_dpi(&mut self, scale_factor: f32) -> Self
pub fn scale_for_dpi(&mut self, scale_factor: f32) -> Self
Scales the size in-place by the given DPI scale factor and returns self.
Sourcepub const fn from_main_cross(
main: f32,
cross: f32,
wm: LayoutWritingMode,
) -> Self
pub const fn from_main_cross( main: f32, cross: f32, wm: LayoutWritingMode, ) -> Self
Creates a LogicalSize from main and cross axis dimensions.
Source§impl LogicalSize
impl LogicalSize
Sourcepub const fn main(&self, wm: LayoutWritingMode) -> f32
pub const fn main(&self, wm: LayoutWritingMode) -> f32
Returns the main-axis dimension for the given writing mode.
Sourcepub const fn cross(&self, wm: LayoutWritingMode) -> f32
pub const fn cross(&self, wm: LayoutWritingMode) -> f32
Returns the cross-axis dimension for the given writing mode.
Sourcepub const fn with_main(self, wm: LayoutWritingMode, value: f32) -> Self
pub const fn with_main(self, wm: LayoutWritingMode, value: f32) -> Self
Returns a new LogicalSize with the main-axis dimension updated.
Sourcepub const fn with_cross(self, wm: LayoutWritingMode, value: f32) -> Self
pub const fn with_cross(self, wm: LayoutWritingMode, value: f32) -> Self
Returns a new LogicalSize with the cross-axis dimension updated.
Source§impl LogicalSize
impl LogicalSize
Trait Implementations§
Source§impl Clone for LogicalSize
impl Clone for LogicalSize
Source§fn clone(&self) -> LogicalSize
fn clone(&self) -> LogicalSize
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 Copy for LogicalSize
Source§impl Debug for LogicalSize
impl Debug for LogicalSize
Source§impl Default for LogicalSize
impl Default for LogicalSize
Source§fn default() -> LogicalSize
fn default() -> LogicalSize
Returns the “default value” for a type. Read more
Source§impl Display for LogicalSize
impl Display for LogicalSize
impl Eq for LogicalSize
Source§impl Hash for LogicalSize
impl Hash for LogicalSize
Source§impl Ord for LogicalSize
impl Ord for LogicalSize
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for LogicalSize
impl PartialEq for LogicalSize
Auto Trait Implementations§
impl Freeze for LogicalSize
impl RefUnwindSafe for LogicalSize
impl Send for LogicalSize
impl Sync for LogicalSize
impl Unpin for LogicalSize
impl UnsafeUnpin for LogicalSize
impl UnwindSafe for LogicalSize
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