pub(crate) enum SDuration {
Span(Span),
Absolute(SignedDuration),
}
Expand description
An internal type for abstracting over signed durations.
This is typically converted to from a Duration
. It enables callers
downstream to implement datetime arithmetic on only two duration types
instead of doing it for three duration types (including
std::time::Duration
).
The main thing making this idea work is that if an unsigned duration cannot fit into a signed duration, then it would overflow any calculation on any datetime type in Jiff anyway. If this weren’t true, then we’d need to support doing actual arithmetic with unsigned durations separately from signed durations.
Variants§
Span(Span)
Absolute(SignedDuration)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SDuration
impl RefUnwindSafe for SDuration
impl Send for SDuration
impl Sync for SDuration
impl Unpin for SDuration
impl UnwindSafe for SDuration
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