pub struct StyleUnits { /* private fields */ }Expand description
Project unit factors a caller resolved (ifc-style links no unit resolver; ADR 0003).
The fields are private so that every value is finite and positive: build
one with StyleUnits::new or take StyleUnits::SI.
ⓘ
use ifc_style::StyleUnits;
let _ = StyleUnits { metres_per_length: Some(f64::NAN), radians_per_angle: None };Implementations§
Source§impl StyleUnits
impl StyleUnits
Sourcepub const SI: Self
pub const SI: Self
Metres and radians; for files known to be SI, never a fallback for undeclared units.
Sourcepub fn metres_per_length(&self) -> Option<f64>
pub fn metres_per_length(&self) -> Option<f64>
Metres per project length unit; None when the project declares no LENGTHUNIT.
Sourcepub fn radians_per_angle(&self) -> Option<f64>
pub fn radians_per_angle(&self) -> Option<f64>
Radians per project plane angle unit; None when no PLANEANGLEUNIT.
Sourcepub fn new(
metres_per_length: Option<f64>,
radians_per_angle: Option<f64>,
) -> StyleResult<Self>
pub fn new( metres_per_length: Option<f64>, radians_per_angle: Option<f64>, ) -> StyleResult<Self>
Unit factors from the two project factors; None states “not declared”.
§Errors
StyleError::InvalidUnits for a factor that is not finite and
greater than zero.
Trait Implementations§
Source§impl Clone for StyleUnits
impl Clone for StyleUnits
Source§fn clone(&self) -> StyleUnits
fn clone(&self) -> StyleUnits
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 StyleUnits
Source§impl Debug for StyleUnits
impl Debug for StyleUnits
Source§impl PartialEq for StyleUnits
impl PartialEq for StyleUnits
impl StructuralPartialEq for StyleUnits
Auto Trait Implementations§
impl Freeze for StyleUnits
impl RefUnwindSafe for StyleUnits
impl Send for StyleUnits
impl Sync for StyleUnits
impl Unpin for StyleUnits
impl UnsafeUnpin for StyleUnits
impl UnwindSafe for StyleUnits
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