Struct sensehat::Angle [−][src]
pub struct Angle { /* fields omitted */ }
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());
Methods
impl Angle
[src]
impl Angle
pub fn from_degrees(degrees: f64) -> Angle
[src]
pub fn from_degrees(degrees: f64) -> Angle
Create a new Angle from a floating point value in degrees
pub fn from_radians(radians: f64) -> Angle
[src]
pub fn from_radians(radians: f64) -> Angle
Create a new Angle from a floating point value in radians
pub fn as_degrees(&self) -> f64
[src]
pub fn as_degrees(&self) -> f64
Convert this Angle to a floating point value in degrees
pub fn as_radians(&self) -> f64
[src]
pub fn as_radians(&self) -> f64
Convert this Angle to a floating point value in radians
pub fn cos(&self) -> f64
[src]
pub fn cos(&self) -> f64
Calculate the cosine of this angle
pub fn sin(&self) -> f64
[src]
pub fn sin(&self) -> f64
Calculate the sine of this angle
pub fn sin_cos(&self) -> (f64, f64)
[src]
pub fn sin_cos(&self) -> (f64, f64)
Calculate the sine and cosine of this angle
pub fn tan(&self) -> f64
[src]
pub fn tan(&self) -> f64
Calculate the tangent of this angle
pub fn asin(num: f64) -> Angle
[src]
pub fn asin(num: f64) -> Angle
Calculate the arcsine of a number
pub fn acos(num: f64) -> Angle
[src]
pub fn acos(num: f64) -> Angle
Calculate the arccosine of a number
pub fn atan(num: f64) -> Angle
[src]
pub fn atan(num: f64) -> Angle
Calculate the arctangent of a number
Trait Implementations
impl Add<Angle> for Angle
[src]
impl Add<Angle> for Angle
type Output = Angle
The resulting type after applying the +
operator.
fn add(self, rhs: Angle) -> Angle
[src]
fn add(self, rhs: Angle) -> Angle
Performs the +
operation.
impl PartialOrd<Angle> for Angle
[src]
impl PartialOrd<Angle> for Angle
fn partial_cmp(&self, other: &Angle) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Angle) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
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
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Sub<Angle> for Angle
[src]
impl Sub<Angle> for Angle
type Output = Angle
The resulting type after applying the -
operator.
fn sub(self, rhs: Angle) -> Angle
[src]
fn sub(self, rhs: Angle) -> Angle
Performs the -
operation.
impl Display for Angle
[src]
impl Display for Angle
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Clone for Angle
[src]
impl Clone for Angle
fn clone(&self) -> Angle
[src]
fn clone(&self) -> Angle
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Angle
[src]
impl Debug for Angle
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Mul<f64> for Angle
[src]
impl Mul<f64> for Angle
type Output = Angle
The resulting type after applying the *
operator.
fn mul(self, rhs: f64) -> Angle
[src]
fn mul(self, rhs: f64) -> Angle
Performs the *
operation.
impl Mul<Angle> for f64
[src]
impl Mul<Angle> for f64
type Output = Angle
The resulting type after applying the *
operator.
fn mul(self, rhs: Angle) -> Angle
[src]
fn mul(self, rhs: Angle) -> Angle
Performs the *
operation.
impl Copy for Angle
[src]
impl Copy for Angle
impl Eq for Angle
[src]
impl Eq for Angle
impl PartialEq<Angle> for Angle
[src]
impl PartialEq<Angle> for Angle
fn eq(&self, other: &Angle) -> bool
[src]
fn eq(&self, other: &Angle) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Measurement for Angle
[src]
impl Measurement for Angle
fn as_base_units(&self) -> f64
[src]
fn as_base_units(&self) -> f64
Get this quantity in the base units
fn from_base_units(units: f64) -> Angle
[src]
fn from_base_units(units: f64) -> Angle
Create a new quantity from the base units
fn get_base_units_name(&self) -> &'static str
[src]
fn get_base_units_name(&self) -> &'static str
Return the base unit for this type, as a string. For example "kilograms" Read more
fn get_appropriate_units(&self) -> (&'static str, f64)
[src]
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
fn pick_appropriate_units(
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
[src]
fn pick_appropriate_units(
&self,
list: &[(&'static str, f64)]
) -> (&'static str, f64)
Given a list of units and their scale relative to the base unit, select the most appropriate one. Read more
impl Div<Angle> for Angle
[src]
impl Div<Angle> for Angle
type Output = f64
The resulting type after applying the /
operator.
fn div(self, rhs: Angle) -> f64
[src]
fn div(self, rhs: Angle) -> f64
Performs the /
operation.
impl Div<f64> for Angle
[src]
impl Div<f64> for Angle