Struct num_format::utils::DecimalStr
source · pub struct DecimalStr<'a>(_);
Expand description
Simple wrapper type for a &str
to make sure its length is less than the maximum for
a decimal (8 bytes).
Implementations§
source§impl<'a> DecimalStr<'a>
impl<'a> DecimalStr<'a>
sourcepub fn new(s: &'a str) -> Result<DecimalStr<'a>, Error>
pub fn new(s: &'a str) -> Result<DecimalStr<'a>, Error>
Constructs an DecimalStr
, ensuring that the length is less than the maximum for
a decimal (8 bytes).
Errors
Returns an error if the provided &str
’s length is more than 8 bytes.
Trait Implementations§
source§impl<'a> AsRef<str> for DecimalStr<'a>
impl<'a> AsRef<str> for DecimalStr<'a>
source§impl<'a> Clone for DecimalStr<'a>
impl<'a> Clone for DecimalStr<'a>
source§fn clone(&self) -> DecimalStr<'a>
fn clone(&self) -> DecimalStr<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a> Debug for DecimalStr<'a>
impl<'a> Debug for DecimalStr<'a>
source§impl<'a> Display for DecimalStr<'a>
impl<'a> Display for DecimalStr<'a>
source§impl<'a> Hash for DecimalStr<'a>
impl<'a> Hash for DecimalStr<'a>
source§impl<'a> Ord for DecimalStr<'a>
impl<'a> Ord for DecimalStr<'a>
source§fn cmp(&self, other: &DecimalStr<'a>) -> Ordering
fn cmp(&self, other: &DecimalStr<'a>) -> Ordering
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<'a> PartialEq<DecimalStr<'a>> for DecimalStr<'a>
impl<'a> PartialEq<DecimalStr<'a>> for DecimalStr<'a>
source§fn eq(&self, other: &DecimalStr<'a>) -> bool
fn eq(&self, other: &DecimalStr<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a> PartialOrd<DecimalStr<'a>> for DecimalStr<'a>
impl<'a> PartialOrd<DecimalStr<'a>> for DecimalStr<'a>
source§fn partial_cmp(&self, other: &DecimalStr<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &DecimalStr<'a>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<'a> Eq for DecimalStr<'a>
impl<'a> StructuralEq for DecimalStr<'a>
impl<'a> StructuralPartialEq for DecimalStr<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for DecimalStr<'a>
impl<'a> Send for DecimalStr<'a>
impl<'a> Sync for DecimalStr<'a>
impl<'a> Unpin for DecimalStr<'a>
impl<'a> UnwindSafe for DecimalStr<'a>
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
source§impl<S> ParseFormatted for Swhere
S: AsRef<str>,
impl<S> ParseFormatted for Swhere S: AsRef<str>,
source§fn parse_formatted<F, N>(&self, format: &F) -> Result<N, Error>where
F: Format,
N: FromFormattedStr,
fn parse_formatted<F, N>(&self, format: &F) -> Result<N, Error>where F: Format, N: FromFormattedStr,
Converts
self
(typically a formatted string) into a number (see Examples above).