pub struct UnitChecker { /* private fields */ }Expand description
Unit Checker - validates unit compatibility and conversions
Implementations§
Source§impl UnitChecker
impl UnitChecker
pub fn new() -> Self
Sourcepub fn check_compatibility(
&self,
unit1: &str,
unit2: &str,
) -> PhysicsResult<bool>
pub fn check_compatibility( &self, unit1: &str, unit2: &str, ) -> PhysicsResult<bool>
Validate unit compatibility (same dimensions)
Sourcepub fn validate_unit(&self, unit: &str) -> PhysicsResult<()>
pub fn validate_unit(&self, unit: &str) -> PhysicsResult<()>
Validate that a unit exists
Sourcepub fn canonical_form(&self, unit: &str) -> PhysicsResult<String>
pub fn canonical_form(&self, unit: &str) -> PhysicsResult<String>
Get canonical form of a unit (if available)
Sourcepub fn can_convert(&self, from: &str, to: &str) -> PhysicsResult<bool>
pub fn can_convert(&self, from: &str, to: &str) -> PhysicsResult<bool>
Check if conversion is possible between units
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UnitChecker
impl RefUnwindSafe for UnitChecker
impl Send for UnitChecker
impl Sync for UnitChecker
impl Unpin for UnitChecker
impl UnsafeUnpin for UnitChecker
impl UnwindSafe for UnitChecker
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more