pub struct Guest;
Expand description

The Guest is the implementation of the Env interface seen and used by contracts built into WASM for execution within a WASM VM. It is a 0-sized “stub” type implementation of the Env interface that forwards each Env method to an external function, imported from its runtime environment. This implementation is automatically generated and has no interesting content.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Get the binary contractID of the contract which invoked the running contract. Traps if the running contract was not invoked by a contract. Read more

Get the binary contractID of the contract which invoked the running contract. Traps if the running contract was not invoked by a contract. Read more

Convert an i64 to an object containing an i64.

Convert an object containing an i64 to an i64.

Create an empty new map.

Insert a key/value mapping into an existing map, and return the map object handle. If the map already has a mapping for the given key, the previous value is overwritten. Read more

Get the value for a key from a map. Traps if key is not found.

Remove a key/value mapping from a map if it exists, traps if doesn’t.

Get the size of a map.

Test for the presence of a key in a map. Returns (SCStatic) TRUE/FALSE.

Given a key, find the first key less than itself in the map’s sorted order. If such a key does not exist, return an SCStatus containing the error code (TBD). Read more

Given a key, find the first key greater than itself in the map’s sorted order. If such a key does not exist, return an SCStatus containing the error code (TBD). Read more

Find the minimum key from a map. If the map is empty, return an SCStatus containing the error code (TBD). Read more

Find the maximum key from a map. If the map is empty, return an SCStatus containing the error code (TBD). Read more

Return a new vector containing all the keys in a map. The new vector is ordered in the original map’s key-sorted order. Read more

Return a new vector containing all the values in a map. The new vector is ordered in the original map’s key-sorted order. Read more

Creates a new vector with an optional capacity hint c. If c is ScStatic::Void, no hint is assumed and the new vector is empty. Otherwise, c is parsed as an u32 that represents the initial capacity of the new vector. Read more

Update the value at index i in the vector. Return the new vector. Trap if the index is out of bounds. Read more

Returns the element at index i of the vector. Traps if the index is out of bound.

Delete an element in a vector at index i, shifting all elements after it to the left. Return the new vector. Traps if the index is out of bound. Read more

Returns length of the vector.

Appends an element to the back of the vector.

Removes the last element from the vector and returns the new vector. Traps if original vector is empty. Read more

Return the first element in the vector. Traps if the vector is empty

Return the last element in the vector. Traps if the vector is empty

Inserts an element at index i within the vector, shifting all elements after it to the right. Traps if the index is out of bound Read more

Clone the vector v1, then moves all the elements of vector v2 into it. Return the new vector. Traps if number of elements in the vector overflows a u32. Read more

Copy the elements from start index until end index, exclusive, in the vector and create a new vector from it. Return the new vector. Traps if the index is out of bound. Read more

Calls a function in another contract with arguments contained in vector args. If the call is successful, forwards the result of the called function. Traps otherwise. Read more

Calls a function in another contract with arguments contained in vector args. Returns: Read more

Constructs a BigInt from an u64.

Converts a BigInt to an u64. Traps if the value cannot fit into u64.

Constructs a BigInt from an i64.

Converts a BigInt to an i64. Traps if the value cannot fit into i64.

Performs the + operation.

Performs the - operation.

Performs the * operation.

Performs the / operation. Traps if y is zero.

Performs the % operation. Traps if y is zero.

Performs the & operation.

Performs the | operation.

Performs the ^ operation.

Performs the << operation. Traps if y is negative or larger than the size of u64.

Performs the >> operation. Traps if y is negative or larger than the size of u64.

Returns an ordering between x and y: -1 (less), 0 (equal) or 1 (greater).

Returns true if x is equal to the additive identity.

Performs the unary - operation.

Performs the unary ! operation.

Calculates the Greatest Common Divisor (GCD) of x and y.

Calculates the Lowest Common Multiple (LCM) of x and y.

Calculates x to the power y. Traps if y is negative or larger than the size of u64.

Calculates (p ^ q) mod m. Note that this rounds like mod_floor, not like the % operator, which makes a difference when given a negative p or m. The result will be in the interval [0, m) for m > 0, or in the interval (m, 0] for m < 0. Traps if the q is negative or the m is zero. Read more

Calculates the truncated principal square root of x. Traps if x is negative.

Determines the fewest bits necessary to express x, not including the sign.

Outputs the BigInt’s magnitude in big-endian byte order into a binary array. The sign is dropped.

Outputs the BigInt’s magnitude in the requested base in big-endian digit order into a binary array. The sign is dropped. Radix must be in the range 2…256. Read more

Serializes an (SC)Val into XDR opaque binary array.

Deserialize a binary array to get back the (SC)Val.

Copies a slice of bytes from a binary array specified at offset b_pos with length len into the linear memory at position lm_pos. Traps if either the binary array or the linear memory doesn’t have enough bytes. Read more

Copies a segment of the linear memory specified at position lm_pos with length len, into a binary array at offset b_pos. The binary array may grow in size to accommodate the new bytes. Traps if the linear memory doesn’t have enough bytes. Read more

Constructs a new binary array initialized with bytes copied from a linear memory slice specified at position lm_pos with length len.

Create an empty new binary.

Update the value at index i in the binary. Return the new binary. Trap if the index is out of bounds. Read more

Returns the element at index i of the binary. Traps if the index is out of bound.

Delete an element in a binary at index i, shifting all elements after it to the left. Return the new binary. Traps if the index is out of bound. Read more

Returns length of the binary.

Appends an element to the back of the binary.

Removes the last element from the binary and returns the new binary. Traps if original binary is empty. Read more

Return the first element in the binary. Traps if the binary is empty

Return the last element in the binary. Traps if the binary is empty

Inserts an element at index i within the binary, shifting all elements after it to the right. Traps if the index is out of bound Read more

Clone the binary b1, then moves all the elements of binary b2 into it. Return the new binary. Traps if number of elements in the binary overflows a u32. Read more

Copies the elements from start index until end index, exclusive, in the binary and creates a new binary from it. Returns the new binary. Traps if the index is out of bound. Read more

Get the low threshold for the account with ed25519 public key a (a is binary). Traps if no such account exists. Read more

Get the medium threshold for the account with ed25519 public key a (a is binary). Traps if no such account exists. Read more

Get the high threshold for the account with ed25519 public key a (a is binary). Traps if no such account exists. Read more

Get the signer weight for the signer with ed25519 public key s (s is binary) on the account with ed25519 public key a (a is binary). Returns the master weight if the signer is the master, and returns 0 if no such signer exists. Traps if no such account exists. Read more

Used for recovering the concrete type of the Host.

Used to check two environments are the same, trapping if not.

Used to clone an environment deeply, not just a handle to it.

Copy a slice of bytes from the caller’s memory into an existing Binary object the host, returning a new Binary. Read more

Copy a slice of bytes from a Binary in the host into the caller’s memory.

For a new Binary in the host from a slice of memory in the caller.

Log a formatted debugging message to the debug log (if present), passing a simplified format string (supporting only positional {} markers) and a single RawVal argument that will be inserted at the marker in the format string. Read more

Log a formatted debugging message to the debug log (if present), passing a simplified format string (supporting only positional {} markers) and a single string-slice argument that will be inserted at the marker in the format string. Read more

Log a formatted debugging message to the debug log (if present), passing a simplified format string (supporting only positional {} markers) and both a RawVal and a string-slice argument, that will each be inserted at markers in the format string. Read more

Log a formatted debugging message to the debug log (if present), passing a simplified format string (supporting only positional {} markers) and both a slice of RawVals and a slice of string-slice argument, that will be sequentially inserted at markers in the format string. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.