Trait Environment

Source
pub trait Environment {
    // Required methods
    fn now_nanos(&self) -> TimestampNanos;
    fn caller(&self) -> Principal;
    fn canister_id(&self) -> CanisterId;
    fn cycles_balance(&self) -> Cycles;

    // Provided methods
    fn now(&self) -> TimestampMillis { ... }
    fn cycles_balance_in_tc(&self) -> f64 { ... }
}
Expand description

Trait for accessing canister environment information.

Required Methods§

Source

fn now_nanos(&self) -> TimestampNanos

Returns the current time in nanoseconds

Source

fn caller(&self) -> Principal

Returns the caller’s principal

Source

fn canister_id(&self) -> CanisterId

Returns the canister’s own ID

Source

fn cycles_balance(&self) -> Cycles

Returns the current cycle balance

Provided Methods§

Implementors§