pub trait Timing {
    // Required methods
    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_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 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;

    // Provided method
    fn contract_id() -> &'static str { ... }
}
Expand description

Allows actors to sleep for a specified duration, or until a desired time. wasmbus.contractId: wasmcloud:timing wasmbus.providerReceive

Required Methods§

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,

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,

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).await
source

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?;

Provided Methods§

source

fn contract_id() -> &'static str

returns the capability contract id for this interface

Implementors§