pub struct Ordinal<T>(pub T);
Tuple Fields§
§0: T
Implementations§
Source§impl<T> Ordinal<T>
impl<T> Ordinal<T>
Sourcepub fn suffix(&self) -> &'static str
pub fn suffix(&self) -> &'static str
Returns the suffix of the ordinal number.
For example, 1
returns "st"
, 2
returns "nd"
, 3
returns "rd"
, and 4
returns "th"
.
This method is useful when you want to format the ordinal number yourself.
use ordinal_type::Ordinal;
let ordinal = Ordinal(1);
assert_eq!(ordinal.suffix(), "st");
Sourcepub fn to_primitive(&self) -> T
pub fn to_primitive(&self) -> T
Returns the primitive value of the ordinal number.
Trait Implementations§
Source§impl<T: Ord> Ord for Ordinal<T>
impl<T: Ord> Ord for Ordinal<T>
1.21.0 · 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<T: PartialOrd> PartialOrd for Ordinal<T>
impl<T: PartialOrd> PartialOrd for Ordinal<T>
impl<T: Copy> Copy for Ordinal<T>
impl<T: Eq> Eq for Ordinal<T>
impl<T> StructuralPartialEq for Ordinal<T>
Auto Trait Implementations§
impl<T> Freeze for Ordinal<T>where
T: Freeze,
impl<T> RefUnwindSafe for Ordinal<T>where
T: RefUnwindSafe,
impl<T> Send for Ordinal<T>where
T: Send,
impl<T> Sync for Ordinal<T>where
T: Sync,
impl<T> Unpin for Ordinal<T>where
T: Unpin,
impl<T> UnwindSafe for Ordinal<T>where
T: UnwindSafe,
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