Struct measurements::angle::Angle
source · [−]pub struct Angle { /* private fields */ }
Expand description
The ‘Angle’ struct can be used to deal with angles in a common way.
Example
use measurements::Angle;
let whole_cake = Angle::from_degrees(360.0);
let pieces = 6.0;
let slice = whole_cake / pieces;
println!("Each slice will be {} degrees", slice.as_degrees());
Implementations
sourceimpl Angle
impl Angle
sourcepub fn from_degrees(degrees: f64) -> Self
pub fn from_degrees(degrees: f64) -> Self
Create a new Angle from a floating point value in degrees
sourcepub fn from_radians(radians: f64) -> Self
pub fn from_radians(radians: f64) -> Self
Create a new Angle from a floating point value in radians
sourcepub fn as_degrees(&self) -> f64
pub fn as_degrees(&self) -> f64
Convert this Angle to a floating point value in degrees
sourcepub fn as_radians(&self) -> f64
pub fn as_radians(&self) -> f64
Convert this Angle to a floating point value in radians
Trait Implementations
sourceimpl Measurement for Angle
impl Measurement for Angle
sourcefn as_base_units(&self) -> f64
fn as_base_units(&self) -> f64
Get this quantity in the base units
sourcefn from_base_units(units: f64) -> Self
fn from_base_units(units: f64) -> Self
Create a new quantity from the base units
sourcefn get_base_units_name(&self) -> &'static str
fn get_base_units_name(&self) -> &'static str
Return the base unit for this type, as a string. For example “kilograms” Read more
sourcefn get_appropriate_units(&self) -> (&'static str, f64)
fn get_appropriate_units(&self) -> (&'static str, f64)
Returns a string containing the most appropriate units for this quantity, and a floating point value representing this quantity in those units. Useful when, for example, a length might be in millimeters if it is very small, or kilometers when it is very large. Read more
sourceimpl PartialOrd<Angle> for Angle
impl PartialOrd<Angle> for Angle
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Angle
impl Eq for Angle
Auto Trait Implementations
impl RefUnwindSafe for Angle
impl Send for Angle
impl Sync for Angle
impl Unpin for Angle
impl UnwindSafe for Angle
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more