Trait wasmcloud_interface_timing::Timing
source · pub trait Timing {
// Required method
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
Provides the capability to read the system time. wasmbus.contractId: wasmcloud:timing wasmbus.providerReceive
Required Methods§
sourcefn 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.
The returned timestamp has nanosecond precision, so care should be taken
to avoid timing attacks. If the timestamp will be made visible to users,
it’s recommended to reduce the precision by truncating or removing the
nsec field.
ⓘ
let sleepy = SleepySender::new();
let now = sleepy.now(ctx).await?;Provided Methods§
sourcefn contract_id() -> &'static str
fn contract_id() -> &'static str
returns the capability contract id for this interface