Struct wasmcloud_interface_timing::TimingSender
source · pub struct TimingSender<T: Transport> { /* private fields */ }Expand description
TimingSender sends messages to a Timing service
Allows actors to sleep for a specified duration, or until a desired time.
client for sending Timing messages
Implementations§
source§impl<T: Transport> TimingSender<T>
impl<T: Transport> TimingSender<T>
pub fn set_timeout(&self, interval: Duration)
Trait Implementations§
source§impl<T: Clone + Transport> Clone for TimingSender<T>
impl<T: Clone + Transport> Clone for TimingSender<T>
source§fn clone(&self) -> TimingSender<T>
fn clone(&self) -> TimingSender<T>
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 moresource§impl<T: Transport + Sync + Send> Timing for TimingSender<T>
impl<T: Transport + Sync + Send> Timing for TimingSender<T>
source§fn sleep<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
arg: &'life2 u32
) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn sleep<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Context, arg: &'life2 u32 ) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Sleep for a specified number of milliseconds
ⓘ
let sleepy = SleepySender::new();
// sleep for 5 seconds
sleepy.sleep(ctx, &5000).await?;source§fn sleep_until<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 Context,
arg: &'life2 Timestamp
) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn sleep_until<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Context, arg: &'life2 Timestamp ) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Sleep until a specified time, provided as a wasmbus_rpc::Timestamp struct.
If the specified time is in the past, the operation will return immediately.
ⓘ
let sleepy = SleepySender::new();
let now = sleepy.now(ctx).await?;
let five_seconds = Timestamp::new(now.sec + 5, now.nsec);
// sleep until 5 seconds from now
sleepy.sleep_until(ctx, &five_seconds).awaitsource§fn now<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 Context
) -> Pin<Box<dyn Future<Output = RpcResult<Timestamp>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn now<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 Context ) -> Pin<Box<dyn Future<Output = RpcResult<Timestamp>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Returns the current time as a wasmbus_rpc::Timestamp struct.
ⓘ
let sleepy = SleepySender::new();
let now = sleepy.now(ctx).await?;source§fn contract_id() -> &'static str
fn contract_id() -> &'static str
returns the capability contract id for this interface