pub struct Syscall;Expand description
System call interface for accessing the runtime environment.
The Syscall struct provides a collection of methods that abstract lower-level operations,
such as retrieving message metadata (ID, size, source, value), fetching the program identifier,
obtaining the current block height, and accessing environment variables.
These methods are essential for enabling on-chain applications to interact with the Gear runtime in a consistent manner. Depending on the target environment, different implementations are provided:
- For the WASM target, direct calls are made to
gstd::msgandgstd::execto fetch runtime data. - In standard (
std) environments, a mock implementation uses thread-local state for testing purposes. - In
no_stdconfigurations without thestdfeature and not WASM target, the functions are marked as unimplemented.
Use these methods to retrieve contextual information about the current execution environment, ensuring that your program logic remains agnostic of the underlying platform specifics.
Implementations§
Source§impl Syscall
impl Syscall
pub fn message_id() -> MessageId
pub fn message_size() -> usize
pub fn message_source() -> ActorId
pub fn message_value() -> u128
pub fn reply_to() -> Result<MessageId, Error>
pub fn reply_code() -> Result<ReplyCode, Error>
pub fn signal_from() -> Result<MessageId, Error>
pub fn signal_code() -> Result<Option<SignalCode>, Error>
pub fn program_id() -> ActorId
pub fn block_height() -> u32
pub fn block_timestamp() -> u64
pub fn value_available() -> u128
pub fn env_vars() -> EnvVars
Auto Trait Implementations§
impl Freeze for Syscall
impl RefUnwindSafe for Syscall
impl Send for Syscall
impl Sync for Syscall
impl Unpin for Syscall
impl UnwindSafe for Syscall
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