pub struct Timer { /* private fields */ }
Implementations§
Source§impl Timer
impl Timer
Sourcepub fn background() -> Self
pub fn background() -> Self
Create a default, independent timer with no time duration limit.
Sourcepub fn with_timeout(timeout: Duration) -> Self
pub fn with_timeout(timeout: Duration) -> Self
Specify the maximum execution duration for the Timer
.
Sourcepub fn in_seconds(secs: u64) -> Self
pub fn in_seconds(secs: u64) -> Self
Specify the maximum execution duration for the Timer
, in seconds.
Sourcepub fn in_milliseconds(millis: u64) -> Self
pub fn in_milliseconds(millis: u64) -> Self
Specify the maximum execution duration for the Timer
, in seconds.
Trait Implementations§
Source§impl Context for Timer
impl Context for Timer
type SubContext = Timer
Source§fn name<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Name> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn name<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Name> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Available on crate feature
name
only.return the name of this context
Source§fn deadline<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Instant>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn deadline<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Instant>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
return the deadline
time::Instant
of this context.
return None when this context doesn’t have deadline.Source§fn cancel<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn cancel<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
cancel this context, then cancel all its childs.
Source§fn is_cancelled<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_cancelled<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
check whether this context is cancelled or not.
Source§fn is_timeout<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_timeout<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
check whether this context is timeout or not.
Source§fn spawn<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
spawn a new child context. Read more
Source§fn spawn_with_timeout<'life0, 'async_trait>(
&'life0 self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn_with_timeout<'life0, 'async_trait>(
&'life0 self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
spawn a new child context, with a new timeout parameter. Read more
Source§fn handle<'a, 'life0, 'async_trait, Fut, Output>(
&'life0 self,
fut: Fut,
) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>>
fn handle<'a, 'life0, 'async_trait, Fut, Output>( &'life0 self, fut: Fut, ) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>>
handle a future Read more
Source§fn error<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn error<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
check whether there is an
Error
in context.Source§fn spawn_in_seconds<'life0, 'async_trait>(
&'life0 self,
secs: u64,
) -> Pin<Box<dyn Future<Output = Self::SubContext> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn_in_seconds<'life0, 'async_trait>(
&'life0 self,
secs: u64,
) -> Pin<Box<dyn Future<Output = Self::SubContext> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
spawn a new child context, with a new timeout parameter in seconds.
Source§fn spawn_in_milliseconds<'life0, 'async_trait>(
&'life0 self,
millis: u64,
) -> Pin<Box<dyn Future<Output = Self::SubContext> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn spawn_in_milliseconds<'life0, 'async_trait>(
&'life0 self,
millis: u64,
) -> Pin<Box<dyn Future<Output = Self::SubContext> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
spawn a new child context, with a new timeout parameter in milliseconds.
Source§impl FromRequest for Timer
Available on crate feature actix-web-from-request
only.
impl FromRequest for Timer
Available on crate feature
actix-web-from-request
only.Auto Trait Implementations§
impl Freeze for Timer
impl !RefUnwindSafe for Timer
impl Send for Timer
impl Sync for Timer
impl Unpin for Timer
impl !UnwindSafe for Timer
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