[−][src]Struct datetime_string::rfc3339::SecfracString
Owned string for a time in RFC 3339 time-secfrac
format, such as .7890
.
Available when alloc
feature is enabled.
To create a value of this type, use str::parse
method or
std::convert::TryFrom
trait, or convert from &SecfracStr
.
Examples
use datetime_string::rfc3339::SecfracStr; use std::convert::TryFrom; let try_from = SecfracString::try_from(".1234")?; let parse = ".1234".parse::<SecfracString>()?; let parse2: SecfracString = ".1234".parse()?; let to_owned = SecfracStr::from_str(".1234")?.to_owned(); let into: SecfracString = SecfracStr::from_str(".1234")?.into();
Implementations
impl SecfracString
[src]
#[must_use]pub fn as_deref(&self) -> &SecfracStr
[src]
Returns a &SecfracStr
for the string.
Examples
use datetime_string::rfc3339::SecfracStr; let secfrac = ".1234".parse::<SecfracString>()?; // Usually you don't need to call `as_deref()` explicitly, because // `Deref<Target = SecfracStr>` trait is implemented. let _: &SecfracStr = secfrac.as_deref();
#[must_use]pub fn as_deref_mut(&mut self) -> &mut SecfracStr
[src]
Returns a &mut SecfracStr
for the string.
Examples
use datetime_string::rfc3339::SecfracStr; let mut secfrac = ".1234".parse::<SecfracString>()?; // Usually you don't need to call `as_deref_mut()` explicitly, because // `DerefMut` trait is implemented. let _: &mut SecfracStr = secfrac.as_deref_mut();
Methods from Deref<Target = SecfracStr>
#[must_use]pub fn as_str(&self) -> &str
[src]
Returns a string slice.
Examples
let secfrac = SecfracStr::from_str(".1234")?; assert_eq!(secfrac.as_str(), ".1234");
#[must_use]pub fn as_bytes(&self) -> &[u8]
[src]
Returns a byte slice.
Examples
let secfrac = SecfracStr::from_str(".1234")?; assert_eq!(secfrac.as_str(), ".1234");
#[must_use]pub fn digits(&self) -> &SecfracDigitsStr
[src]
Returns the digits.
Examples
use datetime_string::common::SecfracDigitsStr; let secfrac = SecfracStr::from_str(".1234")?; assert_eq!(secfrac.digits().as_str(), "1234"); let secfrac2 = SecfracStr::from_str(".012340")?; assert_eq!(secfrac2.digits().as_str(), "012340");
#[must_use]pub fn digits_mut(&mut self) -> &mut SecfracDigitsStr
[src]
Returns the digits as a mutable reference.
Examples
use datetime_string::common::SecfracDigitsStr; let mut buf = ".1234".to_owned(); let secfrac = SecfracStr::from_mut_str(&mut buf)?; let digits = secfrac.digits_mut(); assert_eq!(digits.as_str(), "1234"); digits.fill_with_zero(); assert_eq!(digits.as_str(), "0000"); assert_eq!(secfrac.as_str(), ".0000"); assert_eq!(buf, ".0000");
#[must_use]pub fn milliseconds_secfrac(&self) -> Option<&SecfracStr>
[src]
Returns a milliseconds precision secfrac if there are enough digits.
Examples
let not_precise = SecfracStr::from_str(".1")?; assert_eq!(not_precise.milliseconds_secfrac(), None); let expected = SecfracStr::from_str(".012")?; assert_eq!(expected.milliseconds_secfrac(), Some(expected)); let more_precise = SecfracStr::from_str(".012345678901")?; assert_eq!(more_precise.milliseconds_secfrac(), Some(expected));
#[must_use]pub fn microseconds_secfrac(&self) -> Option<&SecfracStr>
[src]
Returns a microseconds precision secfrac if there are enough digits.
Examples
let not_precise = SecfracStr::from_str(".1234")?; assert_eq!(not_precise.microseconds_secfrac(), None); let expected = SecfracStr::from_str(".012345")?; assert_eq!(expected.microseconds_secfrac(), Some(expected)); let more_precise = SecfracStr::from_str(".012345678901")?; assert_eq!(more_precise.microseconds_secfrac(), Some(expected));
#[must_use]pub fn nanoseconds_secfrac(&self) -> Option<&SecfracStr>
[src]
Returns a nanoseconds precision secfrac if there are enough digits.
Examples
let not_precise = SecfracStr::from_str(".1234")?; assert_eq!(not_precise.nanoseconds_secfrac(), None); let expected = SecfracStr::from_str(".012345678")?; assert_eq!(expected.nanoseconds_secfrac(), Some(expected)); let more_precise = SecfracStr::from_str(".012345678901")?; assert_eq!(more_precise.nanoseconds_secfrac(), Some(expected));
Trait Implementations
impl AsMut<SecfracStr> for SecfracString
[src]
fn as_mut(&mut self) -> &mut SecfracStr
[src]
impl AsRef<[u8]> for SecfracString
[src]
impl AsRef<SecfracStr> for SecfracString
[src]
fn as_ref(&self) -> &SecfracStr
[src]
impl AsRef<str> for SecfracString
[src]
impl Borrow<SecfracStr> for SecfracString
[src]
fn borrow(&self) -> &SecfracStr
[src]
impl BorrowMut<SecfracStr> for SecfracString
[src]
fn borrow_mut(&mut self) -> &mut SecfracStr
[src]
impl Clone for SecfracString
[src]
fn clone(&self) -> SecfracString
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SecfracString
[src]
impl Deref for SecfracString
[src]
type Target = SecfracStr
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl DerefMut for SecfracString
[src]
impl<'de> Deserialize<'de> for SecfracString
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for SecfracString
[src]
impl Eq for SecfracString
[src]
impl<'_> From<&'_ SecfracStr> for SecfracString
[src]
fn from(v: &SecfracStr) -> Self
[src]
impl From<SecfracString> for Vec<u8>
[src]
fn from(v: SecfracString) -> Vec<u8>
[src]
impl From<SecfracString> for String
[src]
fn from(v: SecfracString) -> String
[src]
impl FromStr for SecfracString
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for SecfracString
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for SecfracString
[src]
fn cmp(&self, other: &SecfracString) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<'_> PartialEq<&'_ [u8]> for SecfracString
[src]
impl<'_> PartialEq<&'_ SecfracStr> for SecfracString
[src]
impl<'_> PartialEq<&'_ SecfracString> for SecfracString
[src]
impl<'_> PartialEq<&'_ SecfracString> for str
[src]
impl<'_> PartialEq<&'_ SecfracString> for [u8]
[src]
impl<'_> PartialEq<&'_ str> for SecfracString
[src]
impl PartialEq<[u8]> for SecfracString
[src]
impl<'_> PartialEq<[u8]> for &'_ SecfracString
[src]
impl PartialEq<SecfracStr> for SecfracString
[src]
impl PartialEq<SecfracString> for SecfracString
[src]
fn eq(&self, other: &SecfracString) -> bool
[src]
fn ne(&self, other: &SecfracString) -> bool
[src]
impl<'_> PartialEq<SecfracString> for &'_ SecfracString
[src]
impl PartialEq<SecfracString> for SecfracStr
[src]
impl<'_> PartialEq<SecfracString> for &'_ SecfracStr
[src]
impl PartialEq<SecfracString> for str
[src]
impl<'_> PartialEq<SecfracString> for &'_ str
[src]
impl PartialEq<SecfracString> for [u8]
[src]
impl<'_> PartialEq<SecfracString> for &'_ [u8]
[src]
impl PartialEq<str> for SecfracString
[src]
impl<'_> PartialEq<str> for &'_ SecfracString
[src]
impl<'_> PartialOrd<&'_ [u8]> for SecfracString
[src]
fn partial_cmp(&self, o: &&[u8]) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<&'_ SecfracStr> for SecfracString
[src]
fn partial_cmp(&self, o: &&SecfracStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<&'_ SecfracString> for SecfracString
[src]
fn partial_cmp(&self, o: &&SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<&'_ SecfracString> for str
[src]
fn partial_cmp(&self, o: &&SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<&'_ SecfracString> for [u8]
[src]
fn partial_cmp(&self, o: &&SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<&'_ str> for SecfracString
[src]
fn partial_cmp(&self, o: &&str) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<[u8]> for SecfracString
[src]
fn partial_cmp(&self, o: &[u8]) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<[u8]> for &'_ SecfracString
[src]
fn partial_cmp(&self, o: &[u8]) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<SecfracStr> for SecfracString
[src]
fn partial_cmp(&self, o: &SecfracStr) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<SecfracString> for SecfracString
[src]
fn partial_cmp(&self, other: &SecfracString) -> Option<Ordering>
[src]
fn lt(&self, other: &SecfracString) -> bool
[src]
fn le(&self, other: &SecfracString) -> bool
[src]
fn gt(&self, other: &SecfracString) -> bool
[src]
fn ge(&self, other: &SecfracString) -> bool
[src]
impl<'_> PartialOrd<SecfracString> for &'_ SecfracString
[src]
fn partial_cmp(&self, o: &SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<SecfracString> for SecfracStr
[src]
fn partial_cmp(&self, o: &SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<SecfracString> for &'_ SecfracStr
[src]
fn partial_cmp(&self, o: &SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<SecfracString> for str
[src]
fn partial_cmp(&self, o: &SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<SecfracString> for &'_ str
[src]
fn partial_cmp(&self, o: &SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<SecfracString> for [u8]
[src]
fn partial_cmp(&self, o: &SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<SecfracString> for &'_ [u8]
[src]
fn partial_cmp(&self, o: &SecfracString) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<str> for SecfracString
[src]
fn partial_cmp(&self, o: &str) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<str> for &'_ SecfracString
[src]
fn partial_cmp(&self, o: &str) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for SecfracString
[src]
impl StructuralEq for SecfracString
[src]
impl StructuralPartialEq for SecfracString
[src]
impl<'_> TryFrom<&'_ [u8]> for SecfracString
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(v: &[u8]) -> Result<Self, Self::Error>
[src]
impl<'_> TryFrom<&'_ str> for SecfracString
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(v: &str) -> Result<Self, Self::Error>
[src]
impl TryFrom<String> for SecfracString
[src]
type Error = ConversionError<String>
The type returned in the event of a conversion error.
fn try_from(v: String) -> Result<Self, Self::Error>
[src]
impl TryFrom<Vec<u8>> for SecfracString
[src]
Auto Trait Implementations
impl RefUnwindSafe for SecfracString
impl Send for SecfracString
impl Sync for SecfracString
impl Unpin for SecfracString
impl UnwindSafe for SecfracString
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,