Struct matrix_sdk::ruma::time::SystemTimeError
1.8.0 · source · pub struct SystemTimeError(/* private fields */);
Expand description
An error returned from the duration_since
and elapsed
methods on
SystemTime
, used to learn how far in the opposite direction a system time
lies.
§Examples
use std::thread::sleep;
use std::time::{Duration, SystemTime};
let sys_time = SystemTime::now();
sleep(Duration::from_secs(1));
let new_sys_time = SystemTime::now();
match sys_time.duration_since(new_sys_time) {
Ok(_) => {}
Err(e) => println!("SystemTimeError difference: {:?}", e.duration()),
}
Implementations§
source§impl SystemTimeError
impl SystemTimeError
1.8.0 · sourcepub fn duration(&self) -> Duration
pub fn duration(&self) -> Duration
Returns the positive duration which represents how far forward the second system time was from the first.
A SystemTimeError
is returned from the SystemTime::duration_since
and SystemTime::elapsed
methods whenever the second system time
represents a point later in time than the self
of the method call.
§Examples
use std::thread::sleep;
use std::time::{Duration, SystemTime};
let sys_time = SystemTime::now();
sleep(Duration::from_secs(1));
let new_sys_time = SystemTime::now();
match sys_time.duration_since(new_sys_time) {
Ok(_) => {}
Err(e) => println!("SystemTimeError difference: {:?}", e.duration()),
}
Trait Implementations§
1.8.0 · source§impl Clone for SystemTimeError
impl Clone for SystemTimeError
source§fn clone(&self) -> SystemTimeError
fn clone(&self) -> SystemTimeError
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more1.8.0 · source§impl Debug for SystemTimeError
impl Debug for SystemTimeError
1.8.0 · source§impl Display for SystemTimeError
impl Display for SystemTimeError
1.8.0 · source§impl Error for SystemTimeError
impl Error for SystemTimeError
source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
source§impl From<SystemTimeError> for Error
Available on crate feature std
only.
impl From<SystemTimeError> for Error
Available on crate feature
std
only.source§fn from(_: SystemTimeError) -> Error
fn from(_: SystemTimeError) -> Error
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SystemTimeError
impl RefUnwindSafe for SystemTimeError
impl Send for SystemTimeError
impl Sync for SystemTimeError
impl Unpin for SystemTimeError
impl UnwindSafe for SystemTimeError
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more