pub trait Angle:
Clone
+ Copy
+ Debug
+ Default
+ Display
+ PartialEq
+ Eq
+ PartialOrd
+ Ord
+ Hash
+ TryFrom<OrderedFloat<f64>, Error = Error>
+ Into<OrderedFloat<f64>> {
const MIN: Self;
const MAX: Self;
Show 14 methods
// Required method
fn new(degrees: i32, minutes: u32, seconds: f32) -> Result<Self, Error>
where Self: Sized;
// Provided methods
fn as_float(&self) -> OrderedFloat<f64> { ... }
fn is_zero(&self) -> bool { ... }
fn is_nonzero_positive(&self) -> bool { ... }
fn is_nonzero_negative(&self) -> bool { ... }
fn degrees(&self) -> i32 { ... }
fn minutes(&self) -> u32 { ... }
fn seconds(&self) -> f32 { ... }
fn checked_abs(self) -> Option<Self>
where Self: Sized { ... }
fn overflowing_abs(self) -> (Self, bool)
where Self: Sized { ... }
fn saturating_abs(self) -> Self
where Self: Sized { ... }
fn strict_abs(self) -> Self
where Self: Sized { ... }
fn unchecked_abs(self) -> Self
where Self: Sized { ... }
fn wrapping_abs(self) -> Self
where Self: Sized { ... }
}Required Associated Constants§
Required Methods§
Provided Methods§
fn as_float(&self) -> OrderedFloat<f64>
Sourcefn is_nonzero_positive(&self) -> bool
fn is_nonzero_positive(&self) -> bool
Returns true if the angle is positive and non-zero.
Sourcefn is_nonzero_negative(&self) -> bool
fn is_nonzero_negative(&self) -> bool
Returns true if the angle is negative and non-zero.
Sourcefn degrees(&self) -> i32
fn degrees(&self) -> i32
The signed integer degrees component (carries the sign for negative angles).
Sourcefn checked_abs(self) -> Option<Self>where
Self: Sized,
fn checked_abs(self) -> Option<Self>where
Self: Sized,
Checked absolute value. Computes self.abs(), returning None if self == MIN.
Sourcefn overflowing_abs(self) -> (Self, bool)where
Self: Sized,
fn overflowing_abs(self) -> (Self, bool)where
Self: Sized,
Computes the absolute value of self.
Returns a tuple of the absolute version of self along with a boolean indicating whether an overflow happened. If self is the minimum value Self::MIN, then the minimum value will be returned again and true will be returned for an overflow happening.
Sourcefn saturating_abs(self) -> Selfwhere
Self: Sized,
fn saturating_abs(self) -> Selfwhere
Self: Sized,
Saturating absolute value. Computes self.abs(), returning MAX if self == MIN instead of overflowing.
Sourcefn strict_abs(self) -> Selfwhere
Self: Sized,
fn strict_abs(self) -> Selfwhere
Self: Sized,
Strict absolute value. Computes self.abs(), panicking if self == MIN.
Sourcefn unchecked_abs(self) -> Selfwhere
Self: Sized,
fn unchecked_abs(self) -> Selfwhere
Self: Sized,
Unchecked absolute value. Computes self.abs(), assuming overflow cannot occur.
Calling x.unchecked_abs() is semantically equivalent to calling x.checked_abs().unwrap_unchecked().
If you’re just trying to avoid the panic in debug mode, then do not use this. Instead, you’re looking for wrapping_abs.
Sourcefn wrapping_abs(self) -> Selfwhere
Self: Sized,
fn wrapping_abs(self) -> Selfwhere
Self: Sized,
Wrapping (modular) absolute value. Computes self.abs(), wrapping around at the boundary of the type.
The only case where such wrapping can occur is when one takes the absolute value of the negative minimal value for the type; this is a positive value that is too large to represent in the type. In such a case, this function returns MIN itself.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.