alloy::math

Struct Unit

source
#[repr(transparent)]
pub struct Unit(pub f32);
Expand description

Representation of a unit-based Angle.

A unit is an angle where each revolution is exactly 1. This makes conversion to and from other angular units simple; e.g. 1 Unit is 360 Degree units which means conversion to Degree is just a simple multiplication. Likewise, the inverse conversion is a simple division operation.

Tuple Fields§

§0: f32

Implementations§

source§

impl Unit

source

pub fn to_radians(self) -> Radian

Converts this Unit into Radian.

§Example

Basic use:


assert_eq!(Unit::ONE_REVOLUTION.to_radians(), Radian::ONE_REVOLUTION);
source

pub fn to_degrees(self) -> Degree

Converts this Unit into Degree.

§Example

Basic use:


assert_eq!(Unit::ONE_REVOLUTION.to_degrees(), Degree::ONE_REVOLUTION);
source

pub fn to_gradians(self) -> Gradian

Converts this Unit into Gradian.

§Example

Basic use:


assert_eq!(Unit::ONE_REVOLUTION.to_gradians(), Gradian::ONE_REVOLUTION);
source

pub fn from_radians(angle: Radian) -> Self

Constructs a new Unit object from an existing angle.

§Parameters
  • angle - the angle to construct from
§Example

Basic use:


assert_eq!(Unit::from_radians(Radian::ONE_REVOLUTION), Unit::ONE_REVOLUTION);
source

pub fn from_degrees(angle: Degree) -> Self

Constructs a new Unit object from an existing angle.

§Parameters
  • angle - the angle to construct from
§Example

Basic use:


assert_eq!(Unit::from_degrees(Degree::ONE_REVOLUTION), Unit::ONE_REVOLUTION);
source

pub fn from_gradians(angle: Gradian) -> Self

Constructs a new Unit object from an existing angle.

§Parameters
  • angle - the angle to construct from
§Example

Basic use:


assert_eq!(Unit::from_gradians(Gradian::ONE_REVOLUTION), Unit::ONE_REVOLUTION);
source§

impl Unit

source

pub const ONE_REVOLUTION: Self = _

Constant for the number of units of Self required to perform one full revolution around a unit circle.

source

pub const fn new(value: f32) -> Self

Constructs a new instance of this angle type

§Parameters
  • value - the number of units
source

pub fn constrained(self) -> Self

Constructs a new instance of this angle by constraining the result to be within one revolution.

Note: This will

source

pub fn revolutions(self) -> f32

Counts the number of times this angle has revolved round the unit circle.

source

pub fn abs(self) -> Self

Computes the absolute value of this angle and returns it.

Methods from Deref<Target = f32>§

1.43.0 · source

pub const RADIX: u32 = 2u32

1.43.0 · source

pub const MANTISSA_DIGITS: u32 = 24u32

1.43.0 · source

pub const DIGITS: u32 = 6u32

1.43.0 · source

pub const EPSILON: f32 = 1.1920929E-7f32

1.43.0 · source

pub const MIN: f32 = -3.40282347E+38f32

1.43.0 · source

pub const MIN_POSITIVE: f32 = 1.17549435E-38f32

1.43.0 · source

pub const MAX: f32 = 3.40282347E+38f32

1.43.0 · source

pub const MIN_EXP: i32 = -125i32

1.43.0 · source

pub const MAX_EXP: i32 = 128i32

1.43.0 · source

pub const MIN_10_EXP: i32 = -37i32

1.43.0 · source

pub const MAX_10_EXP: i32 = 38i32

1.43.0 · source

pub const NAN: f32 = NaN_f32

1.43.0 · source

pub const INFINITY: f32 = +Inf_f32

1.43.0 · source

pub const NEG_INFINITY: f32 = -Inf_f32

1.62.0 · source

pub fn total_cmp(&self, other: &f32) -> Ordering

Returns the ordering between self and other.

Unlike the standard partial comparison between floating point numbers, this comparison always produces an ordering in accordance to the totalOrder predicate as defined in the IEEE 754 (2008 revision) floating point standard. The values are ordered in the following sequence:

  • negative quiet NaN
  • negative signaling NaN
  • negative infinity
  • negative numbers
  • negative subnormal numbers
  • negative zero
  • positive zero
  • positive subnormal numbers
  • positive numbers
  • positive infinity
  • positive signaling NaN
  • positive quiet NaN.

The ordering established by this function does not always agree with the PartialOrd and PartialEq implementations of f32. For example, they consider negative and positive zero equal, while total_cmp doesn’t.

The interpretation of the signaling NaN bit follows the definition in the IEEE 754 standard, which may not match the interpretation by some of the older, non-conformant (e.g. MIPS) hardware implementations.

§Example
struct GoodBoy {
    name: String,
    weight: f32,
}

let mut bois = vec![
    GoodBoy { name: "Pucci".to_owned(), weight: 0.1 },
    GoodBoy { name: "Woofer".to_owned(), weight: 99.0 },
    GoodBoy { name: "Yapper".to_owned(), weight: 10.0 },
    GoodBoy { name: "Chonk".to_owned(), weight: f32::INFINITY },
    GoodBoy { name: "Abs. Unit".to_owned(), weight: f32::NAN },
    GoodBoy { name: "Floaty".to_owned(), weight: -5.0 },
];

bois.sort_by(|a, b| a.weight.total_cmp(&b.weight));

// `f32::NAN` could be positive or negative, which will affect the sort order.
if f32::NAN.is_sign_negative() {
    assert!(bois.into_iter().map(|b| b.weight)
        .zip([f32::NAN, -5.0, 0.1, 10.0, 99.0, f32::INFINITY].iter())
        .all(|(a, b)| a.to_bits() == b.to_bits()))
} else {
    assert!(bois.into_iter().map(|b| b.weight)
        .zip([-5.0, 0.1, 10.0, 99.0, f32::INFINITY, f32::NAN].iter())
        .all(|(a, b)| a.to_bits() == b.to_bits()))
}

Trait Implementations§

source§

impl Add<Degree> for Unit

source§

type Output = Unit

The resulting type after applying the + operator.
source§

fn add(self, rhs: Degree) -> Self::Output

Performs the + operation. Read more
source§

impl Add<Gradian> for Unit

source§

type Output = Unit

The resulting type after applying the + operator.
source§

fn add(self, rhs: Gradian) -> Self::Output

Performs the + operation. Read more
source§

impl Add<Radian> for Unit

source§

type Output = Unit

The resulting type after applying the + operator.
source§

fn add(self, rhs: Radian) -> Self::Output

Performs the + operation. Read more
source§

impl Add<Unit> for Degree

source§

type Output = Degree

The resulting type after applying the + operator.
source§

fn add(self, rhs: Unit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<Unit> for Gradian

source§

type Output = Gradian

The resulting type after applying the + operator.
source§

fn add(self, rhs: Unit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<Unit> for Radian

source§

type Output = Radian

The resulting type after applying the + operator.
source§

fn add(self, rhs: Unit) -> Self::Output

Performs the + operation. Read more
source§

impl Add for Unit

source§

type Output = Unit

The resulting type after applying the + operator.
source§

fn add(self, rhs: Unit) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<Degree> for Unit

source§

fn add_assign(&mut self, rhs: Degree)

Performs the += operation. Read more
source§

impl AddAssign<Gradian> for Unit

source§

fn add_assign(&mut self, rhs: Gradian)

Performs the += operation. Read more
source§

impl AddAssign<Radian> for Unit

source§

fn add_assign(&mut self, rhs: Radian)

Performs the += operation. Read more
source§

impl AddAssign<Unit> for Degree

source§

fn add_assign(&mut self, rhs: Unit)

Performs the += operation. Read more
source§

impl AddAssign<Unit> for Gradian

source§

fn add_assign(&mut self, rhs: Unit)

Performs the += operation. Read more
source§

impl AddAssign<Unit> for Radian

source§

fn add_assign(&mut self, rhs: Unit)

Performs the += operation. Read more
source§

impl AddAssign for Unit

source§

fn add_assign(&mut self, rhs: Unit)

Performs the += operation. Read more
source§

impl AlmostEq<Degree> for Unit

source§

fn almost_eq(&self, other: &Degree) -> bool

Tests whether self is almost equal to other Read more
source§

impl AlmostEq<Gradian> for Unit

source§

fn almost_eq(&self, other: &Gradian) -> bool

Tests whether self is almost equal to other Read more
source§

impl AlmostEq<Radian> for Unit

source§

fn almost_eq(&self, other: &Radian) -> bool

Tests whether self is almost equal to other Read more
source§

impl AlmostEq<Unit> for Degree

source§

fn almost_eq(&self, other: &Unit) -> bool

Tests whether self is almost equal to other Read more
source§

impl AlmostEq<Unit> for Gradian

source§

fn almost_eq(&self, other: &Unit) -> bool

Tests whether self is almost equal to other Read more
source§

impl AlmostEq<Unit> for Radian

source§

fn almost_eq(&self, other: &Unit) -> bool

Tests whether self is almost equal to other Read more
source§

impl AlmostEq for Unit

source§

fn almost_eq(&self, other: &Unit) -> bool

Tests whether self is almost equal to other Read more
source§

impl Angle for Unit

source§

fn to_angle<A: Angle>(self) -> A

Converts this Angle to any other generic Angle by converting to Unit as an intermediate value. Read more
source§

fn from_angle<A: Angle>(angle: A) -> Self

Constructs this angle from any other Angle unit value Read more
source§

impl AsMut<f32> for Unit

source§

fn as_mut(&mut self) -> &mut f32

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl AsRef<f32> for Unit

source§

fn as_ref(&self) -> &f32

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Unit

source§

fn clone(&self) -> Unit

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Unit

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Unit

source§

fn default() -> Unit

Returns the “default value” for a type. Read more
source§

impl Deref for Unit

source§

type Target = f32

The resulting type after dereferencing.
source§

fn deref(&self) -> &f32

Dereferences the value.
source§

impl DerefMut for Unit

source§

fn deref_mut(&mut self) -> &mut f32

Mutably dereferences the value.
source§

impl Display for Unit

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<f32> for Unit

source§

type Output = Unit

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign for Unit

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl From<Degree> for Unit

source§

fn from(other: Degree) -> Self

Converts to this type from the input type.
source§

impl From<Gradian> for Unit

source§

fn from(other: Gradian) -> Self

Converts to this type from the input type.
source§

impl From<Radian> for Unit

source§

fn from(other: Radian) -> Self

Converts to this type from the input type.
source§

impl From<Unit> for Degree

source§

fn from(other: Unit) -> Self

Converts to this type from the input type.
source§

impl From<Unit> for Gradian

source§

fn from(other: Unit) -> Self

Converts to this type from the input type.
source§

impl From<Unit> for Radian

source§

fn from(other: Unit) -> Self

Converts to this type from the input type.
source§

impl FromUnit for Unit

source§

fn from_unit(angle: Unit) -> Self

Converts the Unit angle into the new Angle type Read more
source§

impl Mul<Unit> for f32

source§

type Output = Unit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Unit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<f32> for Unit

source§

type Output = Unit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign for Unit

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl Near<Degree> for Unit

source§

fn near(&self, other: &Degree, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl Near<Gradian> for Unit

source§

fn near(&self, other: &Gradian, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl Near<Radian> for Unit

source§

fn near(&self, other: &Radian, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl Near<Unit> for Degree

source§

fn near(&self, other: &Unit, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl Near<Unit> for Gradian

source§

fn near(&self, other: &Unit, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl Near<Unit> for Radian

source§

fn near(&self, other: &Unit, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl Near<Unit> for f32

source§

fn near(&self, other: &Unit, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl Near<f32> for Unit

source§

fn near(&self, other: &f32, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl Near for Unit

source§

fn near(&self, other: &Unit, tolerance: &f32) -> bool

Tests whether self is “near” other relative top the specified tolerance Read more
source§

impl PartialEq<Degree> for Unit

source§

fn eq(&self, other: &Degree) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Gradian> for Unit

source§

fn eq(&self, other: &Gradian) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Radian> for Unit

source§

fn eq(&self, other: &Radian) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Unit> for Degree

source§

fn eq(&self, other: &Unit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Unit> for Gradian

source§

fn eq(&self, other: &Unit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Unit> for Radian

source§

fn eq(&self, other: &Unit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Unit> for f32

source§

fn eq(&self, other: &Unit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<f32> for Unit

source§

fn eq(&self, other: &f32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Unit

source§

fn eq(&self, other: &Unit) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Degree> for Unit

source§

fn partial_cmp(&self, other: &Degree) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Gradian> for Unit

source§

fn partial_cmp(&self, other: &Gradian) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Radian> for Unit

source§

fn partial_cmp(&self, other: &Radian) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Unit> for Degree

source§

fn partial_cmp(&self, other: &Unit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Unit> for Gradian

source§

fn partial_cmp(&self, other: &Unit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Unit> for Radian

source§

fn partial_cmp(&self, other: &Unit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Unit> for f32

source§

fn partial_cmp(&self, other: &Unit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<f32> for Unit

source§

fn partial_cmp(&self, other: &f32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd for Unit

source§

fn partial_cmp(&self, other: &Unit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Rem<f32> for Unit

source§

type Output = Unit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: f32) -> Self::Output

Performs the % operation. Read more
source§

impl RemAssign for Unit

source§

fn rem_assign(&mut self, rhs: Self)

Performs the %= operation. Read more
source§

impl Sub<Degree> for Unit

source§

type Output = Unit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Degree) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<Gradian> for Unit

source§

type Output = Unit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Gradian) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<Radian> for Unit

source§

type Output = Unit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Radian) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<Unit> for Degree

source§

type Output = Degree

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Unit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<Unit> for Gradian

source§

type Output = Gradian

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Unit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<Unit> for Radian

source§

type Output = Radian

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Unit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for Unit

source§

type Output = Unit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Unit) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<Degree> for Unit

source§

fn sub_assign(&mut self, rhs: Degree)

Performs the -= operation. Read more
source§

impl SubAssign<Gradian> for Unit

source§

fn sub_assign(&mut self, rhs: Gradian)

Performs the -= operation. Read more
source§

impl SubAssign<Radian> for Unit

source§

fn sub_assign(&mut self, rhs: Radian)

Performs the -= operation. Read more
source§

impl SubAssign<Unit> for Degree

source§

fn sub_assign(&mut self, rhs: Unit)

Performs the -= operation. Read more
source§

impl SubAssign<Unit> for Gradian

source§

fn sub_assign(&mut self, rhs: Unit)

Performs the -= operation. Read more
source§

impl SubAssign<Unit> for Radian

source§

fn sub_assign(&mut self, rhs: Unit)

Performs the -= operation. Read more
source§

impl SubAssign for Unit

source§

fn sub_assign(&mut self, rhs: Unit)

Performs the -= operation. Read more
source§

impl ToUnit for Unit

source§

fn to_unit(self) -> Unit

Converts this Degree into Unit.

source§

impl Transparent for Unit

source§

type Wrapped = f32

The type that is wrapped by the Transparent impl.
source§

fn from_ref(wrapped: &Self::Wrapped) -> &Self

Converts a reference to a type into a reference of the wrapper type. Read more
source§

fn from_ref_mut(wrapped: &mut Self::Wrapped) -> &mut Self

Converts a mut reference to a wrapped type into a mut reference to the wrapper. Read more
source§

impl Trig for Unit

source§

fn sin(self) -> f32

Computes the sine of this angle.
source§

fn cos(self) -> f32

Computes the cosine of this angle.
source§

fn tan(self) -> f32

Computes the tangent of this angle.
source§

fn sin_cos(self) -> (f32, f32)

Computes the sine and tangent of this angle.
source§

fn asin(value: f32) -> Self

Computes the arc-sine of the input value, returning the Angle Read more
source§

fn acos(value: f32) -> Self

Computes the arc-cosine of the input value, returning the Angle Read more
source§

fn atan(value: f32) -> Self

Computes the arc-tangent of the input value, returning the Angle Read more
source§

impl Copy for Unit

Auto Trait Implementations§

§

impl Freeze for Unit

§

impl RefUnwindSafe for Unit

§

impl Send for Unit

§

impl Sync for Unit

§

impl Unpin for Unit

§

impl UnwindSafe for Unit

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.