pub struct Angle(/* private fields */);Expand description
An angle, as a fraction of a turn.
§Contract
- A full turn is 2³² units, so arithmetic wraps exactly and an angle is always in range by construction. There is no normalisation step and no way to hold an out-of-range angle.
Ordfollows the underlying bits, which orders angles by their position in a turn starting from zero — not by “smallest rotation”, which is not a total order.
Implementations§
Source§impl Angle
impl Angle
Sourcepub const THREE_QUARTERS: Self
pub const THREE_QUARTERS: Self
Three quarters of a turn: 270 degrees.
Sourcepub const fn from_degrees(degrees: i32) -> Self
pub const fn from_degrees(degrees: i32) -> Self
From degrees, exactly for the ones that divide a turn evenly.
Wrapping, so 370 degrees is 10 and −90 is 270 — which is the whole point of the representation rather than a convenience.
Sourcepub const fn from_turn_ratio(numerator: i32, denominator: i32) -> Self
pub const fn from_turn_ratio(numerator: i32, denominator: i32) -> Self
Trait Implementations§
impl Copy for Angle
impl Eq for Angle
Source§impl Ord for Angle
impl Ord for Angle
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Angle
impl PartialOrd for Angle
impl StructuralPartialEq 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