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§
Source§impl Angle
impl Angle
Sourcepub fn from_degrees(degrees: f64) -> Angle
pub fn from_degrees(degrees: f64) -> Angle
Create a new Angle from a floating point value in degrees
Sourcepub fn from_radians(radians: f64) -> Angle
pub fn from_radians(radians: f64) -> Angle
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§
Source§impl Measurement for Angle
impl Measurement for Angle
Source§fn as_base_units(&self) -> f64
fn as_base_units(&self) -> f64
Get this quantity in the base units
Source§fn from_base_units(units: f64) -> Angle
fn from_base_units(units: f64) -> Angle
Create a new quantity from the base units
Source§fn 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”
Source§fn 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
Source§impl PartialOrd for Angle
impl PartialOrd for Angle
impl Copy for Angle
impl Eq for Angle
Auto Trait Implementations§
impl Freeze for Angle
impl RefUnwindSafe for Angle
impl Send for Angle
impl Sync for Angle
impl Unpin for Angle
impl UnsafeUnpin for Angle
impl UnwindSafe for Angle
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