pub(crate) enum SDuration<'a> {
Span(&'a 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(&'a Span)
Absolute(SignedDuration)
Trait Implementations§
impl<'a> Copy for SDuration<'a>
Auto Trait Implementations§
impl<'a> Freeze for SDuration<'a>
impl<'a> RefUnwindSafe for SDuration<'a>
impl<'a> Send for SDuration<'a>
impl<'a> Sync for SDuration<'a>
impl<'a> Unpin for SDuration<'a>
impl<'a> UnwindSafe for SDuration<'a>
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