[−][src]Struct datetime_string::rfc3339::FullTimeString
Owned string for a time in RFC 3339 full-time
format, such as 12:34:56.7890-23:12
.
Available when alloc
feature is enabled.
Examples
use datetime_string::rfc3339::FullTimeStr; use std::convert::TryFrom; let try_from = FullTimeString::try_from("12:34:56.7890-23:12")?; let parse = "12:34:56.7890-23:12".parse::<FullTimeString>()?; let parse2: FullTimeString = "12:34:56.7890-23:12".parse()?; let to_owned = FullTimeStr::from_str("12:34:56.7890-23:12")?.to_owned(); let into: FullTimeString = FullTimeStr::from_str("12:34:56.7890-23:12")?.into();
Implementations
impl FullTimeString
[src]
#[must_use]pub fn as_deref(&self) -> &FullTimeStr
[src]
Returns a &FullTimeStr
for the string.
Examples
use datetime_string::rfc3339::FullTimeStr; let time = "12:34:56.7890-23:12".parse::<FullTimeString>()?; // Usually you don't need to call `as_deref()` explicitly, because // `Deref<Target = FullTimeStr>` trait is implemented. let _: &FullTimeStr = time.as_deref();
#[must_use]pub fn as_deref_mut(&mut self) -> &mut FullTimeStr
[src]
Returns a &mut FullTimeStr
for the string.
Examples
use datetime_string::rfc3339::FullTimeStr; let mut time = "12:34:56.7890-23:12".parse::<FullTimeString>()?; // Usually you don't need to call `as_deref_mut()` explicitly, because // `DerefMut` trait is implemented. let _: &mut FullTimeStr = time.as_deref_mut();
Methods from Deref<Target = FullTimeStr>
#[must_use]pub fn as_str(&self) -> &str
[src]
Returns a string slice.
Examples
let time = FullTimeStr::from_str("12:34:56.7890-23:12")?; assert_eq!(time.as_str(), "12:34:56.7890-23:12");
#[must_use]pub fn as_bytes(&self) -> &[u8]
[src]
Returns a byte slice.
If you want to use indexed access, prefer as_bytes_fixed_len
.
Examples
let time = FullTimeStr::from_str("12:34:56.7890-23:12")?; assert_eq!(time.as_bytes(), b"12:34:56.7890-23:12");
#[must_use]pub fn decompose(&self) -> (&PartialTimeStr, &TimeOffsetStr)
[src]
Decomposes the string into &PartialTimeStr
and &TimeOffsetStr
.
Examples
let time = FullTimeStr::from_str("12:34:56.7890-23:12")?; assert_eq!(time.as_str(), "12:34:56.7890-23:12"); let (partial_time, offset) = time.decompose(); assert_eq!(partial_time.as_str(), "12:34:56.7890"); assert_eq!(offset.as_str(), "-23:12");
#[must_use]pub fn decompose_mut(&mut self) -> (&mut PartialTimeStr, &mut TimeOffsetStr)
[src]
Decomposes the string into &mut PartialTimeStr
and &mut TimeOffsetStr
.
Examples
use datetime_string::common::TimeOffsetSign; let mut buf = "12:34:56.7890-23:12".to_owned(); let time = FullTimeStr::from_mut_str(&mut buf)?; assert_eq!(time.as_str(), "12:34:56.7890-23:12"); let (partial_time, offset) = time.decompose_mut(); assert_eq!(partial_time.as_str(), "12:34:56.7890"); assert_eq!(offset.as_str(), "-23:12"); partial_time.secfrac_mut().unwrap().digits_mut().fill_with_zero(); offset.to_numoffset_mut().unwrap().set_sign(TimeOffsetSign::Positive); assert_eq!(time.as_str(), "12:34:56.0000+23:12");
#[must_use]pub fn partial_time(&self) -> &PartialTimeStr
[src]
Returns a &PartialTimeStr
.
Examples
let time = FullTimeStr::from_str("12:34:56.7890-23:12")?; assert_eq!(time.as_str(), "12:34:56.7890-23:12"); let partial_time = time.partial_time(); assert_eq!(partial_time.as_str(), "12:34:56.7890");
#[must_use]pub fn partial_time_mut(&mut self) -> &mut PartialTimeStr
[src]
Returns a &mut PartialTimeStr
.
Examples
use datetime_string::common::TimeOffsetSign; let mut buf = "12:34:56.7890-23:12".to_owned(); let time = FullTimeStr::from_mut_str(&mut buf)?; assert_eq!(time.as_str(), "12:34:56.7890-23:12"); let partial_time = time.partial_time_mut(); assert_eq!(partial_time.as_str(), "12:34:56.7890"); partial_time.secfrac_mut().unwrap().digits_mut().fill_with_zero(); assert_eq!(time.as_str(), "12:34:56.0000-23:12");
#[must_use]pub fn offset(&self) -> &TimeOffsetStr
[src]
Returns a &TimeOffsetStr
.
Examples
let time = FullTimeStr::from_str("12:34:56.7890-23:12")?; assert_eq!(time.as_str(), "12:34:56.7890-23:12"); let offset = time.offset(); assert_eq!(offset.as_str(), "-23:12");
#[must_use]pub fn offset_mut(&mut self) -> &mut TimeOffsetStr
[src]
Returns a &mut PartialTimeStr
.
Examples
use datetime_string::common::TimeOffsetSign; let mut buf = "12:34:56.7890-23:12".to_owned(); let time = FullTimeStr::from_mut_str(&mut buf)?; assert_eq!(time.as_str(), "12:34:56.7890-23:12"); let offset = time.offset_mut(); assert_eq!(offset.as_str(), "-23:12"); offset.to_numoffset_mut().unwrap().set_sign(TimeOffsetSign::Positive); assert_eq!(time.as_str(), "12:34:56.7890+23:12");
Trait Implementations
impl AsMut<FullTimeStr> for FullTimeString
[src]
fn as_mut(&mut self) -> &mut FullTimeStr
[src]
impl AsRef<[u8]> for FullTimeString
[src]
impl AsRef<FullTimeStr> for FullTimeString
[src]
fn as_ref(&self) -> &FullTimeStr
[src]
impl AsRef<str> for FullTimeString
[src]
impl Borrow<FullTimeStr> for FullTimeString
[src]
fn borrow(&self) -> &FullTimeStr
[src]
impl BorrowMut<FullTimeStr> for FullTimeString
[src]
fn borrow_mut(&mut self) -> &mut FullTimeStr
[src]
impl Clone for FullTimeString
[src]
fn clone(&self) -> FullTimeString
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FullTimeString
[src]
impl Deref for FullTimeString
[src]
type Target = FullTimeStr
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl DerefMut for FullTimeString
[src]
impl<'de> Deserialize<'de> for FullTimeString
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for FullTimeString
[src]
impl Eq for FullTimeString
[src]
impl<'_> From<&'_ FullTimeStr> for FullTimeString
[src]
fn from(v: &FullTimeStr) -> Self
[src]
impl From<FullTimeString> for Vec<u8>
[src]
fn from(v: FullTimeString) -> Vec<u8>
[src]
impl From<FullTimeString> for String
[src]
fn from(v: FullTimeString) -> String
[src]
impl FromStr for FullTimeString
[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 FullTimeString
[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 FullTimeString
[src]
fn cmp(&self, other: &FullTimeString) -> 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 FullTimeString
[src]
impl<'_> PartialEq<&'_ FullTimeStr> for FullTimeString
[src]
impl<'_> PartialEq<&'_ FullTimeString> for FullTimeString
[src]
fn eq(&self, o: &&FullTimeString) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<&'_ FullTimeString> for str
[src]
fn eq(&self, o: &&FullTimeString) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<&'_ FullTimeString> for [u8]
[src]
fn eq(&self, o: &&FullTimeString) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<&'_ str> for FullTimeString
[src]
impl PartialEq<[u8]> for FullTimeString
[src]
impl<'_> PartialEq<[u8]> for &'_ FullTimeString
[src]
impl PartialEq<FullTimeStr> for FullTimeString
[src]
impl PartialEq<FullTimeString> for FullTimeString
[src]
fn eq(&self, other: &FullTimeString) -> bool
[src]
fn ne(&self, other: &FullTimeString) -> bool
[src]
impl<'_> PartialEq<FullTimeString> for &'_ FullTimeString
[src]
impl PartialEq<FullTimeString> for FullTimeStr
[src]
impl<'_> PartialEq<FullTimeString> for &'_ FullTimeStr
[src]
impl PartialEq<FullTimeString> for str
[src]
impl<'_> PartialEq<FullTimeString> for &'_ str
[src]
impl PartialEq<FullTimeString> for [u8]
[src]
impl<'_> PartialEq<FullTimeString> for &'_ [u8]
[src]
impl PartialEq<str> for FullTimeString
[src]
impl<'_> PartialEq<str> for &'_ FullTimeString
[src]
impl<'_> PartialOrd<&'_ [u8]> for FullTimeString
[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<&'_ FullTimeStr> for FullTimeString
[src]
fn partial_cmp(&self, o: &&FullTimeStr) -> 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<&'_ FullTimeString> for FullTimeString
[src]
fn partial_cmp(&self, o: &&FullTimeString) -> 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<&'_ FullTimeString> for str
[src]
fn partial_cmp(&self, o: &&FullTimeString) -> 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<&'_ FullTimeString> for [u8]
[src]
fn partial_cmp(&self, o: &&FullTimeString) -> 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 FullTimeString
[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 FullTimeString
[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 &'_ FullTimeString
[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<FullTimeStr> for FullTimeString
[src]
fn partial_cmp(&self, o: &FullTimeStr) -> 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<FullTimeString> for FullTimeString
[src]
fn partial_cmp(&self, other: &FullTimeString) -> Option<Ordering>
[src]
fn lt(&self, other: &FullTimeString) -> bool
[src]
fn le(&self, other: &FullTimeString) -> bool
[src]
fn gt(&self, other: &FullTimeString) -> bool
[src]
fn ge(&self, other: &FullTimeString) -> bool
[src]
impl<'_> PartialOrd<FullTimeString> for &'_ FullTimeString
[src]
fn partial_cmp(&self, o: &FullTimeString) -> 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<FullTimeString> for FullTimeStr
[src]
fn partial_cmp(&self, o: &FullTimeString) -> 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<FullTimeString> for &'_ FullTimeStr
[src]
fn partial_cmp(&self, o: &FullTimeString) -> 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<FullTimeString> for str
[src]
fn partial_cmp(&self, o: &FullTimeString) -> 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<FullTimeString> for &'_ str
[src]
fn partial_cmp(&self, o: &FullTimeString) -> 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<FullTimeString> for [u8]
[src]
fn partial_cmp(&self, o: &FullTimeString) -> 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<FullTimeString> for &'_ [u8]
[src]
fn partial_cmp(&self, o: &FullTimeString) -> 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 FullTimeString
[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 &'_ FullTimeString
[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 FullTimeString
[src]
impl StructuralEq for FullTimeString
[src]
impl StructuralPartialEq for FullTimeString
[src]
impl<'_> TryFrom<&'_ [u8]> for FullTimeString
[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 FullTimeString
[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 FullTimeString
[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 FullTimeString
[src]
Auto Trait Implementations
impl RefUnwindSafe for FullTimeString
impl Send for FullTimeString
impl Sync for FullTimeString
impl Unpin for FullTimeString
impl UnwindSafe for FullTimeString
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>,