pub struct SleepySender<T: Transport> { /* private fields */ }Expand description
SleepySender sends messages to a Sleepy service
Allows actors to sleep for a specified duration, or until a desired time.
contractId: “jclmnop:sleepy”
client for sending Sleepy messages
Implementations§
Source§impl<T: Transport> SleepySender<T>
impl<T: Transport> SleepySender<T>
pub fn set_timeout(&self, interval: Duration)
Trait Implementations§
Source§impl<T: Clone + Transport> Clone for SleepySender<T>
impl<T: Clone + Transport> Clone for SleepySender<T>
Source§fn clone(&self) -> SleepySender<T>
fn clone(&self) -> SleepySender<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> Sleepy for SleepySender<T>
impl<T: Transport + Sync + Send> Sleepy for SleepySender<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
Auto Trait Implementations§
impl<T> Freeze for SleepySender<T>where
T: Freeze,
impl<T> RefUnwindSafe for SleepySender<T>where
T: RefUnwindSafe,
impl<T> Send for SleepySender<T>
impl<T> Sync for SleepySender<T>
impl<T> Unpin for SleepySender<T>where
T: Unpin,
impl<T> UnwindSafe for SleepySender<T>where
T: UnwindSafe,
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