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
sourceimpl Clone for UnimplementedEnv
impl Clone for UnimplementedEnv
sourcefn clone(&self) -> UnimplementedEnv
fn clone(&self) -> UnimplementedEnv
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Default for UnimplementedEnv
impl Default for UnimplementedEnv
sourcefn default() -> UnimplementedEnv
fn default() -> UnimplementedEnv
Returns the “default value” for a type. Read more
sourceimpl Env for UnimplementedEnv
impl Env for UnimplementedEnv
fn log_value(&self, RawVal) -> RawVal
sourcefn get_invoking_contract(&self) -> Object
fn get_invoking_contract(&self) -> Object
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
fn obj_cmp(&self, RawVal, RawVal) -> i64
fn contract_event(&self, RawVal) -> RawVal
fn system_event(&self, RawVal) -> RawVal
sourcefn get_current_contract(&self) -> Object
fn get_current_contract(&self) -> Object
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
fn obj_from_u64(&self, u64) -> Object
fn obj_to_u64(&self, Object) -> u64
sourcefn obj_from_i64(&self, i64) -> Object
fn obj_from_i64(&self, i64) -> Object
Convert an i64 to an object containing an i64.
sourcefn obj_to_i64(&self, Object) -> i64
fn obj_to_i64(&self, Object) -> i64
Convert an object containing an i64 to an i64.
sourcefn map_put(&self, Object, RawVal, RawVal) -> Object
fn map_put(&self, Object, RawVal, RawVal) -> Object
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
sourcefn map_get(&self, Object, RawVal) -> RawVal
fn map_get(&self, Object, RawVal) -> RawVal
Get the value for a key from a map. Traps if key is not found.
sourcefn map_del(&self, Object, RawVal) -> Object
fn map_del(&self, Object, RawVal) -> Object
Remove a key/value mapping from a map if it exists, traps if doesn’t.
sourcefn map_has(&self, Object, RawVal) -> RawVal
fn map_has(&self, Object, RawVal) -> RawVal
Test for the presence of a key in a map. Returns (SCStatic) TRUE/FALSE.
sourcefn map_prev_key(&self, Object, RawVal) -> RawVal
fn map_prev_key(&self, Object, RawVal) -> RawVal
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
sourcefn map_next_key(&self, Object, RawVal) -> RawVal
fn map_next_key(&self, Object, RawVal) -> RawVal
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
sourcefn map_min_key(&self, Object) -> RawVal
fn map_min_key(&self, Object) -> RawVal
Find the minimum key from a map. If the map is empty, return an SCStatus containing the error code (TBD). Read more
sourcefn map_max_key(&self, Object) -> RawVal
fn map_max_key(&self, Object) -> RawVal
Find the maximum key from a map. If the map is empty, return an SCStatus containing the error code (TBD). Read more
sourcefn map_keys(&self, Object) -> Object
fn map_keys(&self, Object) -> Object
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
sourcefn map_values(&self, Object) -> Object
fn map_values(&self, Object) -> Object
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
sourcefn vec_new(&self, RawVal) -> Object
fn vec_new(&self, RawVal) -> Object
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
sourcefn vec_put(&self, Object, RawVal, RawVal) -> Object
fn vec_put(&self, Object, RawVal, RawVal) -> Object
Update the value at index i
in the vector. Return the new vector.
Trap if the index is out of bounds. Read more
sourcefn vec_get(&self, Object, RawVal) -> RawVal
fn vec_get(&self, Object, RawVal) -> RawVal
Returns the element at index i
of the vector. Traps if the index is out of bound.
sourcefn vec_del(&self, Object, RawVal) -> Object
fn vec_del(&self, Object, RawVal) -> Object
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
sourcefn vec_pop(&self, Object) -> Object
fn vec_pop(&self, Object) -> Object
Removes the last element from the vector and returns the new vector. Traps if original vector is empty. Read more
sourcefn vec_front(&self, Object) -> RawVal
fn vec_front(&self, Object) -> RawVal
Return the first element in the vector. Traps if the vector is empty
sourcefn vec_back(&self, Object) -> RawVal
fn vec_back(&self, Object) -> RawVal
Return the last element in the vector. Traps if the vector is empty
sourcefn vec_insert(&self, Object, RawVal, RawVal) -> Object
fn vec_insert(&self, Object, RawVal, RawVal) -> Object
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
sourcefn vec_append(&self, Object, Object) -> Object
fn vec_append(&self, Object, Object) -> Object
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
sourcefn vec_slice(&self, Object, RawVal, RawVal) -> Object
fn vec_slice(&self, Object, RawVal, RawVal) -> Object
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
fn put_contract_data(&self, RawVal, RawVal) -> RawVal
fn has_contract_data(&self, RawVal) -> RawVal
fn get_contract_data(&self, RawVal) -> RawVal
fn del_contract_data(&self, RawVal) -> RawVal
fn create_contract_from_ed25519(&self, Object, Object, Object, Object) -> Object
fn create_contract_from_contract(&self, Object, Object) -> Object
sourcefn call(&self, Object, Symbol, Object) -> RawVal
fn call(&self, Object, Symbol, Object) -> RawVal
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
sourcefn try_call(&self, Object, Symbol, Object) -> RawVal
fn try_call(&self, Object, Symbol, Object) -> RawVal
Calls a function in another contract with arguments contained in vector args
. Returns: Read more
sourcefn bigint_from_u64(&self, u64) -> Object
fn bigint_from_u64(&self, u64) -> Object
Constructs a BigInt from an u64.
sourcefn bigint_to_u64(&self, Object) -> u64
fn bigint_to_u64(&self, Object) -> u64
Converts a BigInt to an u64. Traps if the value cannot fit into u64.
sourcefn bigint_from_i64(&self, i64) -> Object
fn bigint_from_i64(&self, i64) -> Object
Constructs a BigInt from an i64.
sourcefn bigint_to_i64(&self, Object) -> i64
fn bigint_to_i64(&self, Object) -> i64
Converts a BigInt to an i64. Traps if the value cannot fit into i64.
sourcefn bigint_add(&self, Object, Object) -> Object
fn bigint_add(&self, Object, Object) -> Object
Performs the +
operation.
sourcefn bigint_sub(&self, Object, Object) -> Object
fn bigint_sub(&self, Object, Object) -> Object
Performs the -
operation.
sourcefn bigint_mul(&self, Object, Object) -> Object
fn bigint_mul(&self, Object, Object) -> Object
Performs the *
operation.
sourcefn bigint_div(&self, Object, Object) -> Object
fn bigint_div(&self, Object, Object) -> Object
Performs the /
operation. Traps if y
is zero.
sourcefn bigint_rem(&self, Object, Object) -> Object
fn bigint_rem(&self, Object, Object) -> Object
Performs the %
operation. Traps if y
is zero.
sourcefn bigint_and(&self, Object, Object) -> Object
fn bigint_and(&self, Object, Object) -> Object
Performs the &
operation.
sourcefn bigint_xor(&self, Object, Object) -> Object
fn bigint_xor(&self, Object, Object) -> Object
Performs the ^
operation.
sourcefn bigint_shl(&self, Object, Object) -> Object
fn bigint_shl(&self, Object, Object) -> Object
Performs the <<
operation. Traps if y
is negative or larger than the size of u64.
sourcefn bigint_shr(&self, Object, Object) -> Object
fn bigint_shr(&self, Object, Object) -> Object
Performs the >>
operation. Traps if y
is negative or larger than the size of u64.
sourcefn bigint_cmp(&self, Object, Object) -> RawVal
fn bigint_cmp(&self, Object, Object) -> RawVal
Returns an ordering between x
and y
: -1 (less), 0 (equal) or 1 (greater).
sourcefn bigint_is_zero(&self, Object) -> RawVal
fn bigint_is_zero(&self, Object) -> RawVal
Returns true if x
is equal to the additive identity.
sourcefn bigint_neg(&self, Object) -> Object
fn bigint_neg(&self, Object) -> Object
Performs the unary -
operation.
sourcefn bigint_not(&self, Object) -> Object
fn bigint_not(&self, Object) -> Object
Performs the unary !
operation.
sourcefn bigint_gcd(&self, Object, Object) -> Object
fn bigint_gcd(&self, Object, Object) -> Object
Calculates the Greatest Common Divisor (GCD) of x
and y
.
sourcefn bigint_lcm(&self, Object, Object) -> Object
fn bigint_lcm(&self, Object, Object) -> Object
Calculates the Lowest Common Multiple (LCM) of x
and y
.
sourcefn bigint_pow(&self, Object, Object) -> Object
fn bigint_pow(&self, Object, Object) -> Object
Calculates x
to the power y
. Traps if y
is negative or larger than the size of u64.
sourcefn bigint_pow_mod(&self, Object, Object, Object) -> Object
fn bigint_pow_mod(&self, Object, Object, Object) -> Object
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
sourcefn bigint_sqrt(&self, Object) -> Object
fn bigint_sqrt(&self, Object) -> Object
Calculates the truncated principal square root of x
. Traps if x
is negative.
sourcefn bigint_bits(&self, Object) -> u64
fn bigint_bits(&self, Object) -> u64
Determines the fewest bits necessary to express x
, not including the sign.
sourcefn bigint_to_bytes_be(&self, Object) -> Object
fn bigint_to_bytes_be(&self, Object) -> Object
Outputs the BigInt’s magnitude in big-endian byte order into a binary array. The sign is dropped.
sourcefn bigint_to_radix_be(&self, Object, RawVal) -> Object
fn bigint_to_radix_be(&self, Object, RawVal) -> Object
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
sourcefn serialize_to_binary(&self, RawVal) -> Object
fn serialize_to_binary(&self, RawVal) -> Object
Serializes an (SC)Val into XDR opaque binary array.
sourcefn deserialize_from_binary(&self, Object) -> RawVal
fn deserialize_from_binary(&self, Object) -> RawVal
Deserialize a binary array to get back the (SC)Val.
sourcefn binary_copy_to_linear_memory(&self, Object, RawVal, RawVal, RawVal) -> RawVal
fn binary_copy_to_linear_memory(&self, Object, RawVal, RawVal, RawVal) -> RawVal
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
sourcefn binary_copy_from_linear_memory(&self, Object, RawVal, RawVal, RawVal) -> Object
fn binary_copy_from_linear_memory(&self, Object, RawVal, RawVal, RawVal) -> Object
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
sourcefn binary_new_from_linear_memory(&self, RawVal, RawVal) -> Object
fn binary_new_from_linear_memory(&self, RawVal, RawVal) -> Object
Constructs a new binary array initialized with bytes copied from a linear memory slice specified at position lm_pos
with length len
.
sourcefn binary_new(&self) -> Object
fn binary_new(&self) -> Object
Create an empty new binary.
sourcefn binary_put(&self, Object, RawVal, RawVal) -> Object
fn binary_put(&self, Object, RawVal, RawVal) -> Object
Update the value at index i
in the binary. Return the new binary.
Trap if the index is out of bounds. Read more
sourcefn binary_get(&self, Object, RawVal) -> RawVal
fn binary_get(&self, Object, RawVal) -> RawVal
Returns the element at index i
of the binary. Traps if the index is out of bound.
sourcefn binary_del(&self, Object, RawVal) -> Object
fn binary_del(&self, Object, RawVal) -> Object
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
sourcefn binary_len(&self, Object) -> RawVal
fn binary_len(&self, Object) -> RawVal
Returns length of the binary.
sourcefn binary_push(&self, Object, RawVal) -> Object
fn binary_push(&self, Object, RawVal) -> Object
Appends an element to the back of the binary.
sourcefn binary_pop(&self, Object) -> Object
fn binary_pop(&self, Object) -> Object
Removes the last element from the binary and returns the new binary. Traps if original binary is empty. Read more
sourcefn binary_front(&self, Object) -> RawVal
fn binary_front(&self, Object) -> RawVal
Return the first element in the binary. Traps if the binary is empty
sourcefn binary_back(&self, Object) -> RawVal
fn binary_back(&self, Object) -> RawVal
Return the last element in the binary. Traps if the binary is empty
sourcefn binary_insert(&self, Object, RawVal, RawVal) -> Object
fn binary_insert(&self, Object, RawVal, RawVal) -> Object
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
sourcefn binary_append(&self, Object, Object) -> Object
fn binary_append(&self, Object, Object) -> Object
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
sourcefn binary_slice(&self, Object, RawVal, RawVal) -> Object
fn binary_slice(&self, Object, RawVal, RawVal) -> Object
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
fn hash_from_binary(&self, Object) -> Object
fn hash_to_binary(&self, Object) -> Object
fn public_key_from_binary(&self, Object) -> Object
fn public_key_to_binary(&self, Object) -> Object
fn compute_hash_sha256(&self, Object) -> Object
fn verify_sig_ed25519(&self, Object, Object, Object) -> RawVal
sourcefn account_get_low_threshold(&self, Object) -> RawVal
fn account_get_low_threshold(&self, Object) -> RawVal
Get the low threshold for the account with ed25519 public key a (a is binary). Traps if no such account exists. Read more
sourcefn account_get_medium_threshold(&self, Object) -> RawVal
fn account_get_medium_threshold(&self, Object) -> RawVal
Get the medium threshold for the account with ed25519 public key a (a is binary). Traps if no such account exists. Read more
sourcefn account_get_high_threshold(&self, Object) -> RawVal
fn account_get_high_threshold(&self, Object) -> RawVal
Get the high threshold for the account with ed25519 public key a (a is binary). Traps if no such account exists. Read more
sourcefn account_get_signer_weight(&self, Object, Object) -> RawVal
fn account_get_signer_weight(&self, Object, Object) -> RawVal
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
sourceimpl EnvBase for UnimplementedEnv
impl EnvBase for UnimplementedEnv
sourcefn 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.
sourcefn check_same_env(&self, _other: &UnimplementedEnv)
fn check_same_env(&self, _other: &UnimplementedEnv)
Used to check two environments are the same, trapping if not.
sourcefn deep_clone(&self) -> UnimplementedEnv
fn deep_clone(&self) -> UnimplementedEnv
Used to clone an environment deeply, not just a handle to it.
sourcefn binary_copy_from_slice(&self, _b: Object, _b_pos: RawVal, _mem: &[u8]) -> Object
fn binary_copy_from_slice(&self, _b: Object, _b_pos: RawVal, _mem: &[u8]) -> Object
Copy a slice of bytes from the caller’s memory into an existing Binary
object the host, returning a new Binary
. Read more
sourcefn binary_copy_to_slice(&self, _b: Object, _b_pos: RawVal, _mem: &mut [u8])
fn binary_copy_to_slice(&self, _b: Object, _b_pos: RawVal, _mem: &mut [u8])
Copy a slice of bytes from a Binary
in the host into the caller’s memory.
sourcefn binary_new_from_slice(&self, _mem: &[u8]) -> Object
fn binary_new_from_slice(&self, _mem: &[u8]) -> Object
For a new Binary
in the host from a slice of memory in the caller.
sourcefn log_static_fmt_val(&self, _fmt: &'static str, _v: RawVal)
fn log_static_fmt_val(&self, _fmt: &'static str, _v: RawVal)
sourcefn log_static_fmt_static_str(&self, _fmt: &'static str, _s: &'static str)
fn log_static_fmt_static_str(&self, _fmt: &'static str, _s: &'static str)
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
sourcefn log_static_fmt_val_static_str(
&self,
_fmt: &'static str,
_v: RawVal,
_s: &'static str
)
fn log_static_fmt_val_static_str(
&self,
_fmt: &'static str,
_v: RawVal,
_s: &'static str
)
sourcefn log_static_fmt_general(
&self,
_fmt: &'static str,
_vals: &[RawVal],
_strs: &[&'static str]
)
fn log_static_fmt_general(
&self,
_fmt: &'static str,
_vals: &[RawVal],
_strs: &[&'static str]
)
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
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
. Read more
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
. Read more
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. Read more
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. Read more