pub struct StrPTimeFmt { /* private fields */ }Expand description
A pre-validated, reusable date/time format string.
- Format is validated once at construction (
newreturnsResult). - Format bytes are copied into an owned fixed-size buffer.
- Only ASCII formats are accepted.
Implementations§
Source§impl StrPTimeFmt
impl StrPTimeFmt
Sourcepub fn new(fmt: &str) -> Result<Self, DtErr>
pub fn new(fmt: &str) -> Result<Self, DtErr>
Creates a new validated format.
- Validates syntax and supported directives.
- Requires the format to be valid ASCII and ≤ 256 bytes.
- Returns a
DtErron any failure.
Sourcepub fn to_dt(
&self,
s: &str,
inp_can_end_before_fmt: bool,
fmt_can_end_before_inp: bool,
allow_partial_date: bool,
) -> Result<Dt, DtErr>
pub fn to_dt( &self, s: &str, inp_can_end_before_fmt: bool, fmt_can_end_before_inp: bool, allow_partial_date: bool, ) -> Result<Dt, DtErr>
Parse a date str using this pre-validated format.
pub fn to_str( &self, current: Scale, s: &str, inp_can_end_before_fmt: bool, fmt_can_end_before_inp: bool, allow_partial_date: bool, ) -> Result<String, DtErr>
Trait Implementations§
Source§impl Clone for StrPTimeFmt
impl Clone for StrPTimeFmt
Source§fn clone(&self) -> StrPTimeFmt
fn clone(&self) -> StrPTimeFmt
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StrPTimeFmt
impl Debug for StrPTimeFmt
impl Copy for StrPTimeFmt
Auto Trait Implementations§
impl Freeze for StrPTimeFmt
impl RefUnwindSafe for StrPTimeFmt
impl Send for StrPTimeFmt
impl Sync for StrPTimeFmt
impl Unpin for StrPTimeFmt
impl UnsafeUnpin for StrPTimeFmt
impl UnwindSafe for StrPTimeFmt
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