pub struct Length { /* private fields */ }Expand description
A structure representing a length in points.
§Examples
use typwire::Length;
let length = Length::new(72.0);
assert_eq!(length.pt(), 72.0);
assert_eq!(length.inches(), 1.0);Implementations§
Source§impl Length
impl Length
Sourcepub const fn pt(&self) -> f64
pub const fn pt(&self) -> f64
Returns the length in points.
§Examples
use typwire::Length;
let length = Length::new(72.0);
assert_eq!(length.pt(), 72.0);Sourcepub const fn mm(&self) -> f64
pub const fn mm(&self) -> f64
Converts the length to millimeters.
§Examples
use typwire::Length;
let length = Length::new(72.0);
assert_eq!(length.mm(), 25.4);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Length
impl<'de> Deserialize<'de> for Length
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Length
impl RefUnwindSafe for Length
impl Send for Length
impl Sync for Length
impl Unpin for Length
impl UnwindSafe for Length
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)