Struct soroban_env_host::UnimplementedEnv
source · pub struct UnimplementedEnv;
Expand description
A dummy implementation of the Env trait that fails with unimplemented!()
in
all functions. Useful for certain testing scenarios.
Trait Implementations§
source§impl Clone for UnimplementedEnv
impl Clone for UnimplementedEnv
source§fn clone(&self) -> UnimplementedEnv
fn clone(&self) -> UnimplementedEnv
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Default for UnimplementedEnv
impl Default for UnimplementedEnv
source§fn default() -> UnimplementedEnv
fn default() -> UnimplementedEnv
Returns the “default value” for a type. Read more
source§impl Env for UnimplementedEnv
impl Env for UnimplementedEnv
source§fn log_value(
&self,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn log_value( &self, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
This one variant of logging does not take a format string and is live in both Env=Guest and Env=Host configurations.
source§fn get_invoking_contract(
&self
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn get_invoking_contract( &self ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Get the contractID
Bytes
of the contract which invoked the running contract. Traps if the running contract was not invoked by a contract.fn obj_cmp( &self, _: RawVal, _: RawVal ) -> Result<i64, <UnimplementedEnv as EnvBase>::Error>
source§fn contract_event(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn contract_event( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Records a contract event.
topics
is expected to be a SCVec
with length <= 4 that cannot contain Vec
, Map
, or Bytes
with length > 32 On success, returns an SCStatus::Ok
.source§fn get_current_contract_id(
&self
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn get_current_contract_id( &self ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Gets the 32-byte identifer of the current contract. Traps if the running contract was not invoked by a contract.
source§fn get_ledger_version(
&self
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn get_ledger_version( &self ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Return the protocol version of the current ledger as a u32.
source§fn get_ledger_sequence(
&self
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn get_ledger_sequence( &self ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Return the sequence number of the current ledger as a u32.
source§fn get_ledger_timestamp(
&self
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn get_ledger_timestamp( &self ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Return the timestamp number of the current ledger as a u64.
source§fn get_current_call_stack(
&self
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn get_current_call_stack( &self ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Returns the full call stack from the first contract call to the current one as a vector of vectors, where the inside vector contains the contract id as Hash, and a function as a Symbol.
source§fn fail_with_status(
&self,
_: Status
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn fail_with_status( &self, _: Status ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Causes the currently executing contract to fail immediately with a provided status code, which must be of error-type
ScStatusType::ContractError
. Does not actually return.source§fn log_fmt_values(
&self,
_: Object,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn log_fmt_values( &self, _: Object, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Record a debug event. Fmt must be a Bytes. Args must be a Vec. Void is returned.
source§fn get_invoker_type(&self) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
fn get_invoker_type(&self) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
Get whether the contract invocation is from an account or another contract. Returns 0 for account, 1 for contract.
source§fn get_ledger_network_id(
&self
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn get_ledger_network_id( &self ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Return the network id (sha256 hash of network passphrase) of the current ledger as
Bytes
. The value is always 32 bytes in length.source§fn get_current_contract_address(
&self
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn get_current_contract_address( &self ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Get the Address object for the current contract.
source§fn obj_from_u64(
&self,
_: u64
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn obj_from_u64( &self, _: u64 ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Convert a u64 to an object containing a u64.
source§fn obj_to_u64(
&self,
_: Object
) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
fn obj_to_u64( &self, _: Object ) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
Convert an object containing a i64 to a u64.
source§fn obj_from_i64(
&self,
_: i64
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn obj_from_i64( &self, _: i64 ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Convert an i64 to an object containing an i64.
source§fn obj_to_i64(
&self,
_: Object
) -> Result<i64, <UnimplementedEnv as EnvBase>::Error>
fn obj_to_i64( &self, _: Object ) -> Result<i64, <UnimplementedEnv as EnvBase>::Error>
Convert an object containing an i64 to an i64.
source§fn obj_from_u128_pieces(
&self,
_: u64,
_: u64
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn obj_from_u128_pieces( &self, _: u64, _: u64 ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Convert the low and high 64-bit words of a u128 to an object containing a u128.
source§fn obj_to_u128_lo64(
&self,
_: Object
) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
fn obj_to_u128_lo64( &self, _: Object ) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
Extract the low 64 bits from an object containing a u128.
source§fn obj_to_u128_hi64(
&self,
_: Object
) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
fn obj_to_u128_hi64( &self, _: Object ) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
Extract the high 64 bits from an object containing a u128.
source§fn obj_from_i128_pieces(
&self,
_: u64,
_: u64
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn obj_from_i128_pieces( &self, _: u64, _: u64 ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Convert the lo and hi 64-bit words of an i128 to an object containing an i128.
source§fn obj_to_i128_lo64(
&self,
_: Object
) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
fn obj_to_i128_lo64( &self, _: Object ) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
Extract the low 64 bits from an object containing an i128.
source§fn obj_to_i128_hi64(
&self,
_: Object
) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
fn obj_to_i128_hi64( &self, _: Object ) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
Extract the high 64 bits from an object containing an i128.
source§fn map_new(&self) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn map_new(&self) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Create an empty new map.
source§fn map_put(
&self,
_: Object,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn map_put( &self, _: Object, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
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.
source§fn map_get(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn map_get( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Get the value for a key from a map. Traps if key is not found.
source§fn map_del(
&self,
_: Object,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn map_del( &self, _: Object, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Remove a key/value mapping from a map if it exists, traps if doesn’t.
source§fn map_len(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn map_len( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Get the size of a map.
source§fn map_has(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn map_has( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Test for the presence of a key in a map. Returns (SCStatic) TRUE/FALSE.
source§fn map_prev_key(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn map_prev_key( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
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).
source§fn map_next_key(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn map_next_key( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
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).
source§fn map_min_key(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn map_min_key( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Find the minimum key from a map. If the map is empty, return an SCStatus containing the error code (TBD).
source§fn map_max_key(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn map_max_key( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Find the maximum key from a map. If the map is empty, return an SCStatus containing the error code (TBD).
source§fn map_keys(
&self,
_: Object
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn map_keys( &self, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Return a new vector containing all the keys in a map. The new vector is ordered in the original map’s key-sorted order.
source§fn map_values(
&self,
_: Object
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn map_values( &self, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Return a new vector containing all the values in a map. The new vector is ordered in the original map’s key-sorted order.
source§fn vec_new(
&self,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_new( &self, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
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.source§fn vec_put(
&self,
_: Object,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_put( &self, _: Object, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Update the value at index
i
in the vector. Return the new vector. Trap if the index is out of bounds.source§fn vec_get(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn vec_get( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Returns the element at index
i
of the vector. Traps if the index is out of bound.source§fn vec_del(
&self,
_: Object,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_del( &self, _: Object, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
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.source§fn vec_len(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn vec_len( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Returns length of the vector.
source§fn vec_push_front(
&self,
_: Object,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_push_front( &self, _: Object, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Push a value to the front of a vector.
source§fn vec_pop_front(
&self,
_: Object
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_pop_front( &self, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Removes the first element from the vector and returns the new vector. Traps if original vector is empty.
source§fn vec_push_back(
&self,
_: Object,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_push_back( &self, _: Object, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Appends an element to the back of the vector.
source§fn vec_pop_back(
&self,
_: Object
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_pop_back( &self, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Removes the last element from the vector and returns the new vector. Traps if original vector is empty.
source§fn vec_front(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn vec_front( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Return the first element in the vector. Traps if the vector is empty
source§fn vec_back(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn vec_back( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Return the last element in the vector. Traps if the vector is empty
source§fn vec_insert(
&self,
_: Object,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_insert( &self, _: Object, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Inserts an element at index
i
within the vector, shifting all elements after it to the right. Traps if the index is out of boundsource§fn vec_append(
&self,
_: Object,
_: Object
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_append( &self, _: Object, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
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.source§fn vec_slice(
&self,
_: Object,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn vec_slice( &self, _: Object, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
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.source§fn vec_first_index_of(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn vec_first_index_of( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Get the index of the first occurrence of a given element in the vector. Returns the u32 index of the value if it’s there. Otherwise, it returns
ScStatic::Void
.source§fn vec_last_index_of(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn vec_last_index_of( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Get the index of the last occurrence of a given element in the vector. Returns the u32 index of the value if it’s there. Otherwise, it returns
ScStatic::Void
.source§fn vec_binary_search(
&self,
_: Object,
_: RawVal
) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
fn vec_binary_search( &self, _: Object, _: RawVal ) -> Result<u64, <UnimplementedEnv as EnvBase>::Error>
Binary search a sorted vector for a given element. If it exists, the high-32 bits of the return value is 0x0001 and the low-32 bits contain the u32 index of the element. If it does not exist, the high-32 bits of the return value is 0x0000 and the low-32 bits contain the u32 index at which the element would need to be inserted into the vector to maintain sorted order.
fn put_contract_data( &self, _: RawVal, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn has_contract_data( &self, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn get_contract_data( &self, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn del_contract_data( &self, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
source§fn create_contract_from_contract(
&self,
_: Object,
_: Object
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn create_contract_from_contract( &self, _: Object, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Deploys a contract from the current contract.
wasm_hash
must be a hash of the contract code that has already been installed on this network. salt
is used to create a unique contract id.source§fn call(
&self,
_: Object,
_: Symbol,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn call( &self, _: Object, _: Symbol, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
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.source§fn try_call(
&self,
_: Object,
_: Symbol,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn try_call( &self, _: Object, _: Symbol, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Calls a function in another contract with arguments contained in vector
args
. Returns: - if successful, result of the called function. - otherwise, an SCStatus
containing the error status code.source§fn serialize_to_bytes(
&self,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn serialize_to_bytes( &self, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Serializes an (SC)Val into XDR opaque
Bytes
object.source§fn deserialize_from_bytes(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn deserialize_from_bytes( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Deserialize a
Bytes
object to get back the (SC)Val.source§fn bytes_copy_to_linear_memory(
&self,
_: Object,
_: RawVal,
_: RawVal,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn bytes_copy_to_linear_memory( &self, _: Object, _: RawVal, _: RawVal, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Copies a slice of bytes from a
Bytes
object specified at offset b_pos
with length len
into the linear memory at position lm_pos
. Traps if either the Bytes
object or the linear memory doesn’t have enough bytes.source§fn bytes_copy_from_linear_memory(
&self,
_: Object,
_: RawVal,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_copy_from_linear_memory( &self, _: Object, _: RawVal, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Copies a segment of the linear memory specified at position
lm_pos
with length len
, into a Bytes
object at offset b_pos
. The Bytes
object may grow in size to accommodate the new bytes. Traps if the linear memory doesn’t have enough bytes.source§fn bytes_new_from_linear_memory(
&self,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_new_from_linear_memory( &self, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Constructs a new
Bytes
object initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.source§fn bytes_new(&self) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_new(&self) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Create an empty new
Bytes
object.source§fn bytes_put(
&self,
_: Object,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_put( &self, _: Object, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Update the value at index
i
in the Bytes
object. Return the new Bytes
. Trap if the index is out of bounds.source§fn bytes_get(
&self,
_: Object,
_: RawVal
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn bytes_get( &self, _: Object, _: RawVal ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Returns the element at index
i
of the Bytes
object. Traps if the index is out of bound.source§fn bytes_del(
&self,
_: Object,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_del( &self, _: Object, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Delete an element in a
Bytes
object at index i
, shifting all elements after it to the left. Return the new Bytes
. Traps if the index is out of bound.source§fn bytes_len(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn bytes_len( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Returns length of the
Bytes
object.source§fn bytes_push(
&self,
_: Object,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_push( &self, _: Object, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Appends an element to the back of the
Bytes
object.source§fn bytes_pop(
&self,
_: Object
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_pop( &self, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Removes the last element from the
Bytes
object and returns the new Bytes
. Traps if original Bytes
is empty.source§fn bytes_front(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn bytes_front( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Return the first element in the
Bytes
object. Traps if the Bytes
is emptysource§fn bytes_back(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn bytes_back( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Return the last element in the
Bytes
object. Traps if the Bytes
is emptysource§fn bytes_insert(
&self,
_: Object,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_insert( &self, _: Object, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Inserts an element at index
i
within the Bytes
object, shifting all elements after it to the right. Traps if the index is out of boundsource§fn bytes_append(
&self,
_: Object,
_: Object
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_append( &self, _: Object, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Clone the
Bytes
object b1
, then moves all the elements of Bytes
object b2
into it. Return the new Bytes
. Traps if its length overflows a u32.source§fn bytes_slice(
&self,
_: Object,
_: RawVal,
_: RawVal
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_slice( &self, _: Object, _: RawVal, _: RawVal ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Copies the elements from
start
index until end
index, exclusive, in the Bytes
object and creates a new Bytes
from it. Returns the new Bytes
. Traps if the index is out of bound.fn compute_hash_sha256( &self, _: Object ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn verify_sig_ed25519( &self, _: Object, _: Object, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
source§fn require_auth_for_args(
&self,
_: Object,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn require_auth_for_args( &self, _: Object, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Checks if the address has authorized the invocation of the current contract function with the provided arguments. Traps if the invocation hasn’t been authorized.
source§fn require_auth(
&self,
_: Object
) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
fn require_auth( &self, _: Object ) -> Result<RawVal, <UnimplementedEnv as EnvBase>::Error>
Checks if the address has authorized the invocation of the current contract function with all the arguments of the invocation. Traps if the invocation hasn’t been authorized.
source§impl EnvBase for UnimplementedEnv
impl EnvBase for UnimplementedEnv
§type Error = Infallible
type Error = Infallible
The type of error returned from the environment when the environment
itself fails “unrecoverably”, or at least in a way that the user is not
expected to be able to recover from, such as an internal logic error,
exceeding the execution budget, or being passed malformed input in a way
that the user-facing API does not anticipate or allow for. This type is
returned from all environment-interface methods, and will only ever
take on two possible concrete types: either
Infallible
(in the
Guest
) or HostError
(in the Host
). Read moresource§fn escalate_error_to_panic(&self, _e: <UnimplementedEnv as EnvBase>::Error) -> !
fn escalate_error_to_panic(&self, _e: <UnimplementedEnv as EnvBase>::Error) -> !
Reject an error from the environment, turning it into a panic but on
terms that the environment controls (eg. transforming or logging it).
This should only ever be called by client-side / SDK local-testing code,
never in the
Host
.source§fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
Used for recovering the concrete type of the Host.
source§fn check_same_env(&self, _other: &UnimplementedEnv)
fn check_same_env(&self, _other: &UnimplementedEnv)
Used to check two environments are the same, trapping if not.
source§fn deep_clone(&self) -> UnimplementedEnv
fn deep_clone(&self) -> UnimplementedEnv
Used to clone an environment deeply, not just a handle to it.
source§fn bytes_copy_from_slice(
&self,
_b: Object,
_b_pos: RawVal,
_mem: &[u8]
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_copy_from_slice( &self, _b: Object, _b_pos: RawVal, _mem: &[u8] ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Copy a slice of bytes from the caller’s memory into an existing
Bytes
object the host, returning a new Bytes
.source§fn bytes_copy_to_slice(
&self,
_b: Object,
_b_pos: RawVal,
_mem: &mut [u8]
) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
fn bytes_copy_to_slice( &self, _b: Object, _b_pos: RawVal, _mem: &mut [u8] ) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
Copy a slice of bytes from a
Bytes
object in the host into the
caller’s memory.source§fn bytes_new_from_slice(
&self,
_mem: &[u8]
) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
fn bytes_new_from_slice( &self, _mem: &[u8] ) -> Result<Object, <UnimplementedEnv as EnvBase>::Error>
Form a new
Bytes
object in the host from a slice of memory in the
caller.source§fn log_static_fmt_val(
&self,
_fmt: &'static str,
_v: RawVal
) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
fn log_static_fmt_val( &self, _fmt: &'static str, _v: RawVal ) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
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.source§fn log_static_fmt_static_str(
&self,
_fmt: &'static str,
_s: &'static str
) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
fn log_static_fmt_static_str( &self, _fmt: &'static str, _s: &'static str ) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
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.source§fn log_static_fmt_val_static_str(
&self,
_fmt: &'static str,
_v: RawVal,
_s: &'static str
) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
fn log_static_fmt_val_static_str( &self, _fmt: &'static str, _v: RawVal, _s: &'static str ) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
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.source§fn log_static_fmt_general(
&self,
_fmt: &'static str,
_vals: &[RawVal],
_strs: &[&'static str]
) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
fn log_static_fmt_general( &self, _fmt: &'static str, _vals: &[RawVal], _strs: &[&'static str] ) -> Result<(), <UnimplementedEnv as EnvBase>::Error>
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.Auto Trait Implementations§
impl RefUnwindSafe for UnimplementedEnv
impl Send for UnimplementedEnv
impl Sync for UnimplementedEnv
impl Unpin for UnimplementedEnv
impl UnwindSafe for UnimplementedEnv
Blanket Implementations§
source§impl<T, U, E, C> Compare<(T, U)> for Cwhere
C: Compare<T, Error = E, Error = E> + Compare<U>,
impl<T, U, E, C> Compare<(T, U)> for Cwhere C: Compare<T, Error = E, Error = E> + Compare<U>,
source§impl<T, U, V, E, C> Compare<(T, U, V)> for Cwhere
C: Compare<T, Error = E, Error = E, Error = E> + Compare<U> + Compare<V>,
impl<T, U, V, E, C> Compare<(T, U, V)> for Cwhere C: Compare<T, Error = E, Error = E, Error = E> + Compare<U> + Compare<V>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.