[−][src]Struct datetime_string::rfc3339::PartialTimeStr
String slice for a time in RFC 3339 partial-time format, such as 12:34:56.7890.
This is "partial", because it is not associated to a time offset.
Implementations
impl PartialTimeStr[src]
pub fn from_str(s: &str) -> Result<&Self, Error>[src]
Creates a new &PartialTimeStr from a string slice.
Examples
let time = PartialTimeStr::from_str("12:34:56.7890")?; assert_eq!(time.as_str(), "12:34:56.7890"); assert!(PartialTimeStr::from_str("12:34:56").is_ok()); assert!(PartialTimeStr::from_str("12:34:56.0").is_ok()); assert!(PartialTimeStr::from_str("12:34:56.01234567890").is_ok()); assert!(PartialTimeStr::from_str("12:34:56.").is_err()); assert!(PartialTimeStr::from_str(".").is_err()); assert!(PartialTimeStr::from_str("12:34.56").is_err());
pub fn from_mut_str(s: &mut str) -> Result<&mut Self, Error>[src]
Creates a new &mut PartialTimeStr from a mutable string slice.
Examples
let mut buf = "12:34:56.7890".to_owned(); let time = PartialTimeStr::from_mut_str(&mut buf)?; assert_eq!(time.as_str(), "12:34:56.7890"); time.hms_mut().set_time(23, 12, 01); time.secfrac_mut().unwrap().digits_mut().fill_with_zero(); assert_eq!(time.as_str(), "23:12:01.0000"); assert_eq!(buf, "23:12:01.0000");
pub fn from_bytes(s: &[u8]) -> Result<&Self, Error>[src]
Creates a new &PartialTimeStr from a byte slice.
Examples
let time = PartialTimeStr::from_bytes(b"12:34:56.7890")?; assert_eq!(time.as_str(), "12:34:56.7890"); assert!(PartialTimeStr::from_bytes(b"12:34:56").is_ok()); assert!(PartialTimeStr::from_bytes(b"12:34:56.0").is_ok()); assert!(PartialTimeStr::from_bytes(b"12:34:56.01234567890").is_ok()); assert!(PartialTimeStr::from_bytes(b"12:34:56.").is_err()); assert!(PartialTimeStr::from_bytes(b".").is_err()); assert!(PartialTimeStr::from_bytes(b"12:34.56").is_err());
pub fn from_bytes_mut(s: &mut [u8]) -> Result<&mut Self, Error>[src]
Creates a new &mut PartialTimeStr from a mutable byte slice.
Examples
let mut buf: [u8; 13] = *b"12:34:56.7890"; let time = PartialTimeStr::from_bytes_mut(&mut buf)?; assert_eq!(time.as_str(), "12:34:56.7890"); time.hms_mut().set_time(23, 12, 01); time.secfrac_mut().unwrap().digits_mut().fill_with_zero(); assert_eq!(time.as_str(), "23:12:01.0000"); assert_eq!(&buf[..], b"23:12:01.0000");
#[must_use]pub fn as_str(&self) -> &str[src]
Returns a string slice.
Examples
let time = PartialTimeStr::from_str("12:34:56.7890")?; assert_eq!(time.as_str(), "12:34:56.7890");
#[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 = PartialTimeStr::from_str("12:34:56.7890")?; assert_eq!(time.as_str(), "12:34:56.7890");
#[must_use]pub fn hms(&self) -> &Hms6ColonStr[src]
Returns a hh:mm:ss substring.
Examples
let time = PartialTimeStr::from_str("12:34:56.7890")?; assert_eq!(time.hms(), "12:34:56");
#[must_use]pub fn hms_mut(&mut self) -> &mut Hms6ColonStr[src]
Returns a mutable hh:mm:ss substring.
Examples
let mut buf = "12:34:56.7890".to_owned(); let time = PartialTimeStr::from_mut_str(&mut buf)?; assert_eq!(time.as_str(), "12:34:56.7890"); time.hms_mut().set_time(23, 12, 1); assert_eq!(time.as_str(), "23:12:01.7890");
#[must_use]pub fn secfrac(&self) -> Option<&SecfracStr>[src]
Returns time-secfrac substring.
Examples
let time = PartialTimeStr::from_str("12:34:56.7890")?; assert_eq!(time.secfrac().unwrap(), ".7890");
#[must_use]pub fn secfrac_mut(&mut self) -> Option<&mut SecfracStr>[src]
Returns a mutable time-secfrac substring.
Examples
let mut buf = "12:34:56.7890".to_owned(); let time = PartialTimeStr::from_mut_str(&mut buf)?; assert_eq!(time.as_str(), "12:34:56.7890"); time.hms_mut().set_time(23, 12, 1); assert_eq!(time.as_str(), "23:12:01.7890");
Trait Implementations
impl AsMut<PartialTimeStr> for PartialTimeString[src]
fn as_mut(&mut self) -> &mut PartialTimeStr[src]
impl AsMut<PartialTimeStr> for PartialTimeStr[src]
fn as_mut(&mut self) -> &mut PartialTimeStr[src]
impl AsRef<[u8]> for PartialTimeStr[src]
impl AsRef<PartialTimeStr> for PartialTimeString[src]
fn as_ref(&self) -> &PartialTimeStr[src]
impl AsRef<PartialTimeStr> for PartialTimeStr[src]
fn as_ref(&self) -> &PartialTimeStr[src]
impl AsRef<str> for PartialTimeStr[src]
impl Borrow<PartialTimeStr> for PartialTimeString[src]
fn borrow(&self) -> &PartialTimeStr[src]
impl BorrowMut<PartialTimeStr> for PartialTimeString[src]
fn borrow_mut(&mut self) -> &mut PartialTimeStr[src]
impl Debug for PartialTimeStr[src]
impl Deref for PartialTimeStr[src]
impl<'de> Deserialize<'de> for &'de PartialTimeStr[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]
D: Deserializer<'de>,
impl Display for PartialTimeStr[src]
impl Eq for PartialTimeStr[src]
impl<'_> From<&'_ PartialTimeStr> for PartialTimeString[src]
fn from(v: &PartialTimeStr) -> Self[src]
impl<'a> From<&'a PartialTimeStr> for &'a str[src]
fn from(v: &'a PartialTimeStr) -> Self[src]
impl Hash for PartialTimeStr[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 PartialTimeStr[src]
fn cmp(&self, other: &PartialTimeStr) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl<'_> PartialEq<&'_ [u8]> for PartialTimeStr[src]
impl<'_> PartialEq<&'_ PartialTimeStr> for PartialTimeString[src]
fn eq(&self, o: &&PartialTimeStr) -> bool[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<&'_ PartialTimeStr> for PartialTimeStr[src]
fn eq(&self, o: &&PartialTimeStr) -> bool[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<&'_ PartialTimeStr> for [u8][src]
fn eq(&self, o: &&PartialTimeStr) -> bool[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<&'_ PartialTimeStr> for str[src]
fn eq(&self, o: &&PartialTimeStr) -> bool[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<&'_ str> for PartialTimeStr[src]
impl PartialEq<[u8]> for PartialTimeStr[src]
impl<'_> PartialEq<[u8]> for &'_ PartialTimeStr[src]
impl PartialEq<PartialTimeStr> for PartialTimeString[src]
impl PartialEq<PartialTimeStr> for PartialTimeStr[src]
fn eq(&self, other: &PartialTimeStr) -> bool[src]
fn ne(&self, other: &PartialTimeStr) -> bool[src]
impl<'_> PartialEq<PartialTimeStr> for &'_ PartialTimeStr[src]
impl PartialEq<PartialTimeStr> for [u8][src]
impl<'_> PartialEq<PartialTimeStr> for &'_ [u8][src]
impl PartialEq<PartialTimeStr> for str[src]
impl<'_> PartialEq<PartialTimeStr> for &'_ str[src]
impl PartialEq<PartialTimeString> for PartialTimeStr[src]
fn eq(&self, o: &PartialTimeString) -> bool[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<PartialTimeString> for &'_ PartialTimeStr[src]
fn eq(&self, o: &PartialTimeString) -> bool[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialEq<str> for PartialTimeStr[src]
impl<'_> PartialEq<str> for &'_ PartialTimeStr[src]
impl<'_> PartialOrd<&'_ [u8]> for PartialTimeStr[src]
fn partial_cmp(&self, o: &&[u8]) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ PartialTimeStr> for PartialTimeString[src]
fn partial_cmp(&self, o: &&PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ PartialTimeStr> for PartialTimeStr[src]
fn partial_cmp(&self, o: &&PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ PartialTimeStr> for [u8][src]
fn partial_cmp(&self, o: &&PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ PartialTimeStr> for str[src]
fn partial_cmp(&self, o: &&PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ str> for PartialTimeStr[src]
fn partial_cmp(&self, o: &&str) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<[u8]> for PartialTimeStr[src]
fn partial_cmp(&self, o: &[u8]) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<[u8]> for &'_ PartialTimeStr[src]
fn partial_cmp(&self, o: &[u8]) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<PartialTimeStr> for PartialTimeString[src]
fn partial_cmp(&self, o: &PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<PartialTimeStr> for PartialTimeStr[src]
fn partial_cmp(&self, other: &PartialTimeStr) -> Option<Ordering>[src]
fn lt(&self, other: &PartialTimeStr) -> bool[src]
fn le(&self, other: &PartialTimeStr) -> bool[src]
fn gt(&self, other: &PartialTimeStr) -> bool[src]
fn ge(&self, other: &PartialTimeStr) -> bool[src]
impl<'_> PartialOrd<PartialTimeStr> for &'_ PartialTimeStr[src]
fn partial_cmp(&self, o: &PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<PartialTimeStr> for [u8][src]
fn partial_cmp(&self, o: &PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<PartialTimeStr> for &'_ [u8][src]
fn partial_cmp(&self, o: &PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<PartialTimeStr> for str[src]
fn partial_cmp(&self, o: &PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<PartialTimeStr> for &'_ str[src]
fn partial_cmp(&self, o: &PartialTimeStr) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<PartialTimeString> for PartialTimeStr[src]
fn partial_cmp(&self, o: &PartialTimeString) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<PartialTimeString> for &'_ PartialTimeStr[src]
fn partial_cmp(&self, o: &PartialTimeString) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<str> for PartialTimeStr[src]
fn partial_cmp(&self, o: &str) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<str> for &'_ PartialTimeStr[src]
fn partial_cmp(&self, o: &str) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl Serialize for PartialTimeStr[src]
impl StructuralEq for PartialTimeStr[src]
impl StructuralPartialEq for PartialTimeStr[src]
impl ToOwned for PartialTimeStr[src]
type Owned = PartialTimeString
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 PartialTimeStr[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 PartialTimeStr[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 PartialTimeStr[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 PartialTimeStr[src]
Auto Trait Implementations
impl RefUnwindSafe for PartialTimeStr
impl Send for PartialTimeStr
impl Sync for PartialTimeStr
impl Unpin for PartialTimeStr
impl UnwindSafe for PartialTimeStr
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,