[−][src]Struct datetime_string::rfc3339::SecfracStr
String slice for a time in RFC 3339 time-secfrac
format, such as .7890
.
Implementations
impl SecfracStr
[src]
pub fn from_str(s: &str) -> Result<&Self, Error>
[src]
Creates a new &SecfracStr
from a string slice.
Examples
let secfrac = SecfracStr::from_str(".1234")?; assert_eq!(secfrac.as_str(), ".1234"); assert!(SecfracStr::from_str(".0").is_ok()); assert!(SecfracStr::from_str(".0000000000").is_ok()); assert!(SecfracStr::from_str(".9999999999").is_ok()); assert!(SecfracStr::from_str("0").is_err(), "A leading period is required"); assert!(SecfracStr::from_str(".").is_err(), "One or more digits are required");
pub fn from_mut_str(s: &mut str) -> Result<&mut Self, Error>
[src]
Creates a new &mut SecfracStr
from a mutable string slice.
Examples
let mut buf = ".1234".to_owned(); let secfrac = SecfracStr::from_mut_str(&mut buf)?; assert_eq!(secfrac.as_str(), ".1234"); secfrac.digits_mut().fill_with_zero(); assert_eq!(secfrac.as_str(), ".0000"); assert_eq!(buf, ".0000");
pub fn from_bytes(s: &[u8]) -> Result<&Self, Error>
[src]
Creates a new &SecfracStr
from a byte slice.
Examples
let secfrac = SecfracStr::from_bytes(b".1234")?; assert_eq!(secfrac.as_str(), ".1234"); assert!(SecfracStr::from_bytes(b".0").is_ok()); assert!(SecfracStr::from_bytes(b".0000000000").is_ok()); assert!(SecfracStr::from_bytes(b".9999999999").is_ok()); assert!(SecfracStr::from_bytes(b"0").is_err(), "A leading period is required"); assert!(SecfracStr::from_bytes(b".").is_err(), "One or more digits are required");
pub fn from_bytes_mut(s: &mut [u8]) -> Result<&mut Self, Error>
[src]
Creates a new &mut SecfracStr
from a mutable byte slice.
Examples
let mut buf: [u8; 5] = *b".1234"; let secfrac = SecfracStr::from_bytes_mut(&mut buf)?; assert_eq!(secfrac.as_str(), ".1234"); secfrac.digits_mut().fill_with_zero(); assert_eq!(secfrac.as_str(), ".0000"); assert_eq!(&buf[..], b".0000");
#[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 AsMut<SecfracStr> for SecfracStr
[src]
fn as_mut(&mut self) -> &mut SecfracStr
[src]
impl AsRef<[u8]> for SecfracStr
[src]
impl AsRef<SecfracStr> for SecfracString
[src]
fn as_ref(&self) -> &SecfracStr
[src]
impl AsRef<SecfracStr> for SecfracStr
[src]
fn as_ref(&self) -> &SecfracStr
[src]
impl AsRef<str> for SecfracStr
[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 Debug for SecfracStr
[src]
impl Deref for SecfracStr
[src]
impl<'de> Deserialize<'de> for &'de SecfracStr
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for SecfracStr
[src]
impl Eq for SecfracStr
[src]
impl<'_> From<&'_ SecfracStr> for SecfracString
[src]
fn from(v: &SecfracStr) -> Self
[src]
impl<'a> From<&'a SecfracStr> for &'a str
[src]
fn from(v: &'a SecfracStr) -> Self
[src]
impl Hash for SecfracStr
[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 SecfracStr
[src]
fn cmp(&self, other: &SecfracStr) -> 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 SecfracStr
[src]
impl<'_> PartialEq<&'_ SecfracStr> for SecfracString
[src]
impl<'_> PartialEq<&'_ SecfracStr> for SecfracStr
[src]
impl<'_> PartialEq<&'_ SecfracStr> for [u8]
[src]
impl<'_> PartialEq<&'_ SecfracStr> for str
[src]
impl<'_> PartialEq<&'_ str> for SecfracStr
[src]
impl PartialEq<[u8]> for SecfracStr
[src]
impl<'_> PartialEq<[u8]> for &'_ SecfracStr
[src]
impl PartialEq<SecfracStr> for SecfracString
[src]
impl PartialEq<SecfracStr> for SecfracStr
[src]
fn eq(&self, other: &SecfracStr) -> bool
[src]
fn ne(&self, other: &SecfracStr) -> bool
[src]
impl<'_> PartialEq<SecfracStr> for &'_ SecfracStr
[src]
impl PartialEq<SecfracStr> for [u8]
[src]
impl<'_> PartialEq<SecfracStr> for &'_ [u8]
[src]
impl PartialEq<SecfracStr> for str
[src]
impl<'_> PartialEq<SecfracStr> for &'_ str
[src]
impl PartialEq<SecfracString> for SecfracStr
[src]
impl<'_> PartialEq<SecfracString> for &'_ SecfracStr
[src]
impl PartialEq<str> for SecfracStr
[src]
impl<'_> PartialEq<str> for &'_ SecfracStr
[src]
impl<'_> PartialOrd<&'_ [u8]> for SecfracStr
[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<&'_ SecfracStr> for SecfracStr
[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<&'_ SecfracStr> for [u8]
[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<&'_ SecfracStr> for str
[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<&'_ str> for SecfracStr
[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 SecfracStr
[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 &'_ SecfracStr
[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<SecfracStr> for SecfracStr
[src]
fn partial_cmp(&self, other: &SecfracStr) -> Option<Ordering>
[src]
fn lt(&self, other: &SecfracStr) -> bool
[src]
fn le(&self, other: &SecfracStr) -> bool
[src]
fn gt(&self, other: &SecfracStr) -> bool
[src]
fn ge(&self, other: &SecfracStr) -> bool
[src]
impl<'_> PartialOrd<SecfracStr> for &'_ SecfracStr
[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<SecfracStr> for [u8]
[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<SecfracStr> for &'_ [u8]
[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<SecfracStr> for str
[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<SecfracStr> for &'_ str
[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 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<str> for SecfracStr
[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 &'_ SecfracStr
[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 SecfracStr
[src]
impl StructuralEq for SecfracStr
[src]
impl StructuralPartialEq for SecfracStr
[src]
impl ToOwned for SecfracStr
[src]
type Owned = SecfracString
The resulting type after obtaining ownership.
fn to_owned(&self) -> Self::Owned
[src]
fn clone_into(&self, target: &mut Self::Owned)
[src]
impl<'a> TryFrom<&'a [u8]> for &'a SecfracStr
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(v: &'a [u8]) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a mut [u8]> for &'a mut SecfracStr
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(v: &'a mut [u8]) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a mut str> for &'a mut SecfracStr
[src]
type Error = Error
The type returned in the event of a conversion error.
fn try_from(v: &'a mut str) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a str> for &'a SecfracStr
[src]
Auto Trait Implementations
impl RefUnwindSafe for SecfracStr
impl Send for SecfracStr
impl Sync for SecfracStr
impl Unpin for SecfracStr
impl UnwindSafe for SecfracStr
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> 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,