pub struct Odd<G: KeyPiece>(/* private fields */);Expand description
An odd number of type G. It is never zero, so it is stored as a NonZero,
which lets Option use zero to represent None and makes Option<Odd<G>>
the same size as G.
Implementations§
Source§impl<G: KeyPiece> Odd<G>
impl<G: KeyPiece> Odd<G>
Sourcepub unsafe fn new_unchecked(value: G) -> Self
pub unsafe fn new_unchecked(value: G) -> Self
Sourcepub fn wrapping_next(self) -> Even<G>
pub fn wrapping_next(self) -> Even<G>
The even number after this one. The largest value of G wraps around
to zero.
Trait Implementations§
impl<G: Copy + KeyPiece> Copy for Odd<G>
impl<G: Eq + KeyPiece> Eq for Odd<G>
Source§impl<G: Ord + KeyPiece> Ord for Odd<G>
impl<G: Ord + KeyPiece> Ord for Odd<G>
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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<G: PartialOrd + KeyPiece> PartialOrd for Odd<G>where
G::NonZero: PartialOrd,
impl<G: PartialOrd + KeyPiece> PartialOrd for Odd<G>where
G::NonZero: PartialOrd,
impl<G: PartialEq + KeyPiece> StructuralPartialEq for Odd<G>
Auto Trait Implementations§
impl<G> Freeze for Odd<G>
impl<G> RefUnwindSafe for Odd<G>
impl<G> Send for Odd<G>
impl<G> Sync for Odd<G>
impl<G> Unpin for Odd<G>
impl<G> UnsafeUnpin for Odd<G>
impl<G> UnwindSafe for Odd<G>
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