Struct myelin_geometry::Radians
source · pub struct Radians { /* private fields */ }
Expand description
A radian confined to the range of [0.0; 2π)
Implementations§
source§impl Radians
impl Radians
sourcepub fn try_new(value: f64) -> Result<Self, RadiansError>
pub fn try_new(value: f64) -> Result<Self, RadiansError>
Creates a new instance of Radians
.
§Errors
Returns a RadiansError
if the given value is outside the range [0.0; 2π)
§Examples
use myelin_geometry::Radians;
use std::f64::consts::PI;
let rotation = Radians::try_new(PI).expect("Value was outside the range [0.0; 2π)");
sourcepub fn try_from_degrees(degrees: f64) -> Result<Self, RadiansError>
pub fn try_from_degrees(degrees: f64) -> Result<Self, RadiansError>
Convert degrees to radians
§Errors
Returns a RadiansError
if the given value is outside the range [0.0°; 360°)
§Examples
use myelin_geometry::Radians;
use std::f64::consts::FRAC_PI_2;
use std::f64::consts::PI;
use nearly_eq::assert_nearly_eq;
assert_nearly_eq!(FRAC_PI_2, Radians::try_from_degrees(90.0).unwrap().value());
Trait Implementations§
source§impl<'de> Deserialize<'de> for Radians
impl<'de> Deserialize<'de> for Radians
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
source§impl PartialEq for Radians
impl PartialEq for Radians
impl Copy for Radians
impl StructuralPartialEq for Radians
Auto Trait Implementations§
impl Freeze for Radians
impl RefUnwindSafe for Radians
impl Send for Radians
impl Sync for Radians
impl Unpin for Radians
impl UnwindSafe for Radians
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> 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