pub struct InterfaceImpl {
    config: ExecutionConfig,
    context: Arc<Mutex<ExecutionContext>>,
}
Expand description

an implementation of the Interface trait (see massa-sc-runtime crate)

Fields§

§config: ExecutionConfig

execution configuration

§context: Arc<Mutex<ExecutionContext>>

thread-safe shared access to the execution context (see context.rs)

Implementations§

source§

impl InterfaceImpl

source

pub fn new( config: ExecutionConfig, context: Arc<Mutex<ExecutionContext>>, ) -> InterfaceImpl

creates a new InterfaceImpl

§Arguments
  • config: execution configuration
  • context: thread-safe shared access to the current execution context (see context.rs)
source

fn bypass_event_limitation(&self, call_stack: Vec<Address>) -> bool

Trait Implementations§

source§

impl Clone for InterfaceImpl

source§

fn clone(&self) -> InterfaceImpl

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Interface for InterfaceImpl

Implementation of the Interface trait providing functions for massa-sc-runtime to call in order to interact with the execution context during bytecode execution. See the massa-sc-runtime crate for a functional description of the trait and its methods. Note that massa-sc-runtime uses basic types (str for addresses, u64 for amounts…) for genericity.

source§

fn print(&self, message: &str) -> Result<()>

prints a message in the node logs at log level 3 (debug)

source§

fn init_call(&self, address: &str, raw_coins: u64) -> Result<Vec<u8>>

Initialize the call when bytecode calls a function from another bytecode This function transfers the coins passed as parameter, prepares the current execution context by pushing a new element on the top of the call stack, and returns the target bytecode from the ledger.

§Arguments
  • address: string representation of the target address on which the bytecode will be called
  • raw_coins: raw representation (without decimal factor) of the amount of coins to transfer from the caller address to the target address at the beginning of the call
§Returns

The target bytecode or an error

source§

fn finish_call(&self) -> Result<()>

Called to finish the call process after a bytecode calls a function from another one. This function just pops away the top element of the call stack.

source§

fn get_module(&self, bytecode: &[u8], gas_limit: u64) -> Result<RuntimeModule>

Get the module from cache if possible, compile it if not

§Returns

A massa-sc-runtime CL compiled module & the remaining gas after loading the module

source§

fn get_tmp_module( &self, bytecode: &[u8], gas_limit: u64, ) -> Result<RuntimeModule>

Compile and return a temporary module

§Returns

A massa-sc-runtime SP compiled module & the remaining gas after loading the module

source§

fn get_balance(&self) -> Result<u64>

Gets the balance of the current address address (top of the stack).

§Returns

The raw representation (no decimal factor) of the balance of the address, or zero if the address is not found in the ledger.

[DeprecatedByNewRuntime] Replaced by get_balance_wasmv1

source§

fn get_balance_for(&self, address: &str) -> Result<u64>

Gets the balance of arbitrary address passed as argument.

§Arguments
  • address: string representation of the address for which to get the balance
§Returns

The raw representation (no decimal factor) of the balance of the address, or zero if the address is not found in the ledger.

[DeprecatedByNewRuntime] Replaced by get_balance_wasmv1

source§

fn get_balance_wasmv1(&self, address: Option<String>) -> Result<NativeAmount>

Gets the balance of arbitrary address passed as argument, or the balance of the current address if no argument is passed.

§Arguments
  • address: string representation of the address for which to get the balance
§Returns

The raw representation (no decimal factor) of the balance of the address, or zero if the address is not found in the ledger.

source§

fn create_module(&self, bytecode: &[u8]) -> Result<String>

Creates a new ledger entry with the initial bytecode given as argument. A new unique address is generated for that entry and returned.

§Arguments
  • bytecode: the bytecode to set for the newly created address
§Returns

The string representation of the newly created address

source§

fn get_keys(&self, prefix_opt: Option<&[u8]>) -> Result<BTreeSet<Vec<u8>>>

Get the datastore keys (aka entries) for a given address

§Returns

A list of keys (keys are byte arrays)

[DeprecatedByNewRuntime] Replaced by get_keys_wasmv1

source§

fn get_keys_for( &self, address: &str, prefix_opt: Option<&[u8]>, ) -> Result<BTreeSet<Vec<u8>>>

Get the datastore keys (aka entries) for a given address

§Returns

A list of keys (keys are byte arrays)

[DeprecatedByNewRuntime] Replaced by get_keys_wasmv1

source§

fn get_ds_keys_wasmv1( &self, prefix: &[u8], address: Option<String>, ) -> Result<BTreeSet<Vec<u8>>>

Get the datastore keys (aka entries) for a given address, or the current address if none is provided

§Returns

A list of keys (keys are byte arrays)

source§

fn raw_get_data(&self, key: &[u8]) -> Result<Vec<u8>>

Gets a datastore value by key for the current address (top of the call stack).

§Arguments
  • key: string key of the datastore entry to retrieve
§Returns

The datastore value matching the provided key, if found, otherwise an error.

[DeprecatedByNewRuntime] Replaced by raw_get_data_wasmv1

source§

fn raw_get_data_for(&self, address: &str, key: &[u8]) -> Result<Vec<u8>>

Gets a datastore value by key for a given address.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry to retrieve
§Returns

The datastore value matching the provided key, if found, otherwise an error.

[DeprecatedByNewRuntime] Replaced by raw_get_data_wasmv1

source§

fn get_ds_value_wasmv1( &self, key: &[u8], address: Option<String>, ) -> Result<Vec<u8>>

Gets a datastore value by key for a given address, or the current address if none is provided.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry to retrieve
§Returns

The datastore value matching the provided key, if found, otherwise an error.

source§

fn raw_set_data(&self, key: &[u8], value: &[u8]) -> Result<()>

Sets a datastore entry for the current address (top of the call stack). Fails if the address does not exist. Creates the entry if does not exist.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry to set
  • value: new value to set

[DeprecatedByNewRuntime] Replaced by raw_set_data_wasmv1

source§

fn raw_set_data_for( &self, address: &str, key: &[u8], value: &[u8], ) -> Result<()>

Sets a datastore entry for a given address. Fails if the address does not exist. Creates the entry if it does not exist.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry to set
  • value: new value to set

[DeprecatedByNewRuntime] Replaced by raw_set_data_wasmv1

source§

fn raw_append_data(&self, key: &[u8], value: &[u8]) -> Result<()>

Appends data to a datastore entry for the current address (top of the call stack). Fails if the address or entry does not exist.

§Arguments
  • key: string key of the datastore entry
  • value: value to append

[DeprecatedByNewRuntime] Replaced by raw_append_data_wasmv1

source§

fn raw_append_data_for( &self, address: &str, key: &[u8], value: &[u8], ) -> Result<()>

Appends a value to a datastore entry for a given address. Fails if the entry or address does not exist.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry
  • value: value to append

[DeprecatedByNewRuntime] Replaced by raw_append_data_wasmv1

source§

fn append_ds_value_wasmv1( &self, key: &[u8], value: &[u8], address: Option<String>, ) -> Result<()>

Appends a value to a datastore entry for a given address, or the current address if none is provided Fails if the entry or address does not exist.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry
  • value: value to append
source§

fn raw_delete_data(&self, key: &[u8]) -> Result<()>

Deletes a datastore entry by key for the current address (top of the call stack). Fails if the address or entry does not exist.

§Arguments
  • key: string key of the datastore entry to delete

[DeprecatedByNewRuntime] Replaced by raw_delete_data_wasmv1

source§

fn raw_delete_data_for(&self, address: &str, key: &[u8]) -> Result<()>

Deletes a datastore entry by key for a given address. Fails if the address or entry does not exist.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry to delete

[DeprecatedByNewRuntime] Replaced by raw_delete_data_wasmv1

source§

fn delete_ds_entry_wasmv1( &self, key: &[u8], address: Option<String>, ) -> Result<()>

Deletes a datastore entry by key for a given address, or the current address if none is provided. Fails if the address or entry does not exist.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry to delete
source§

fn has_data(&self, key: &[u8]) -> Result<bool>

Checks if a datastore entry exists for the current address (top of the call stack).

§Arguments
  • key: string key of the datastore entry to retrieve
§Returns

true if the address exists and has the entry matching the provided key in its datastore, otherwise false

[DeprecatedByNewRuntime] Replaced by has_data_wasmv1

source§

fn has_data_for(&self, address: &str, key: &[u8]) -> Result<bool>

Checks if a datastore entry exists for a given address.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry to retrieve
§Returns

true if the address exists and has the entry matching the provided key in its datastore, otherwise false

[DeprecatedByNewRuntime] Replaced by has_data_wasmv1

source§

fn ds_entry_exists_wasmv1( &self, key: &[u8], address: Option<String>, ) -> Result<bool>

Checks if a datastore entry exists for a given address, or the current address if none is provided.

§Arguments
  • address: string representation of the address
  • key: string key of the datastore entry to retrieve
§Returns

true if the address exists and has the entry matching the provided key in its datastore, otherwise false

source§

fn caller_has_write_access(&self) -> Result<bool>

Check whether or not the caller has write access in the current context

§Returns

true if the caller has write access

source§

fn raw_get_bytecode(&self) -> Result<Vec<u8>>

Returns bytecode of the current address

[DeprecatedByNewRuntime] Replaced by raw_get_bytecode_wasmv1

source§

fn raw_get_bytecode_for(&self, address: &str) -> Result<Vec<u8>>

Returns bytecode of the target address

[DeprecatedByNewRuntime] Replaced by raw_get_bytecode_wasmv1

source§

fn get_bytecode_wasmv1(&self, address: Option<String>) -> Result<Vec<u8>>

Returns bytecode of the target address, or the current address if not provided

source§

fn get_op_keys(&self, prefix_opt: Option<&[u8]>) -> Result<Vec<Vec<u8>>>

Get the operation datastore keys (aka entries). Note that the datastore is only accessible to the initial caller level.

§Returns

A list of keys (keys are byte arrays)

[DeprecatedByNewRuntime] Replaced by get_op_keys_wasmv1

source§

fn get_op_keys_wasmv1(&self, prefix: &[u8]) -> Result<Vec<Vec<u8>>>

Get the operation datastore keys (aka entries). Note that the datastore is only accessible to the initial caller level.

§Returns

A list of keys (keys are byte arrays) that match the given prefix

source§

fn op_entry_exists(&self, key: &[u8]) -> Result<bool>

Checks if an operation datastore entry exists in the operation datastore. Note that the datastore is only accessible to the initial caller level.

§Arguments
  • key: byte array key of the datastore entry to retrieve
§Returns

true if the entry is matching the provided key in its operation datastore, otherwise false

source§

fn get_op_data(&self, key: &[u8]) -> Result<Vec<u8>>

Gets an operation datastore value by key. Note that the datastore is only accessible to the initial caller level.

§Arguments
  • key: byte array key of the datastore entry to retrieve
§Returns

The operation datastore value matching the provided key, if found, otherwise an error.

source§

fn hash(&self, data: &[u8]) -> Result<[u8; 32]>

Hashes arbitrary data

§Arguments
  • data: data bytes to hash
§Returns

The hash in bytes format

source§

fn address_from_public_key(&self, public_key: &str) -> Result<String>

Converts a public key to an address

§Arguments
  • public_key: string representation of the public key
§Returns

The string representation of the resulting address

source§

fn signature_verify( &self, data: &[u8], signature: &str, public_key: &str, ) -> Result<bool>

Verifies a signature

§Arguments
  • data: the data bytes that were signed
  • signature: string representation of the signature
  • public key: string representation of the public key to check against
§Returns

true if the signature verification succeeded, false otherwise

source§

fn evm_signature_verify( &self, message_: &[u8], signature_: &[u8], public_key_: &[u8], ) -> Result<bool>

Verify an EVM signature

Information:

  • Expects a SECP256K1 signature in full ETH format. Format: (r, s, v) v will be ignored Length: 65 bytes
  • Expects a public key in raw secp256k1 format. Length: 64 bytes
source§

fn hash_keccak256(&self, bytes: &[u8]) -> Result<[u8; 32]>

Keccak256 hash function

source§

fn evm_get_address_from_pubkey(&self, public_key_: &[u8]) -> Result<Vec<u8>>

Get an EVM address from a raw secp256k1 public key (64 bytes). Address is the last 20 bytes of the hash of the public key.

source§

fn evm_get_pubkey_from_signature( &self, hash_: &[u8], signature_: &[u8], ) -> Result<Vec<u8>>

Get a raw secp256k1 public key from an EVM signature and the signed hash.

source§

fn transfer_coins(&self, to_address: &str, raw_amount: u64) -> Result<()>

Transfer coins from the current address (top of the call stack) towards a target address.

§Arguments
  • to_address: string representation of the address to which the coins are sent
  • raw_amount: raw representation (no decimal factor) of the amount of coins to transfer

[DeprecatedByNewRuntime] Replaced by transfer_coins_wasmv1

source§

fn transfer_coins_for( &self, from_address: &str, to_address: &str, raw_amount: u64, ) -> Result<()>

Transfer coins from a given address towards a target address.

§Arguments
  • from_address: string representation of the address that is sending the coins
  • to_address: string representation of the address to which the coins are sent
  • raw_amount: raw representation (no decimal factor) of the amount of coins to transfer

[DeprecatedByNewRuntime] Replaced by transfer_coins_wasmv1

source§

fn transfer_coins_wasmv1( &self, to_address: String, raw_amount: NativeAmount, from_address: Option<String>, ) -> Result<()>

Transfer coins from a given address (or the current address if not specified) towards a target address.

§Arguments
  • to_address: string representation of the address to which the coins are sent
  • raw_amount: raw representation (no decimal factor) of the amount of coins to transfer
  • from_address: string representation of the address that is sending the coins
source§

fn get_owned_addresses(&self) -> Result<Vec<String>>

Returns the list of owned addresses (top of the call stack). Those addresses are the ones the current execution context has write access to, typically it includes the current address itself, but also the ones that were created previously by the current call to allow initializing them.

§Returns

A vector with the string representation of each owned address. Note that the ordering of this vector is deterministic and conserved.

source§

fn get_call_stack(&self) -> Result<Vec<String>>

Returns the addresses in the call stack, from the bottom to the top.

§Returns

A vector with the string representation of each call stack address.

source§

fn get_call_coins(&self) -> Result<u64>

Gets the amount of coins that have been transferred at the beginning of the call. See the init_call method.

§Returns

The raw representation (no decimal factor) of the amount of coins

[DeprecatedByNewRuntime] Replaced by get_call_coins_wasmv1

source§

fn get_call_coins_wasmv1(&self) -> Result<NativeAmount>

Gets the amount of coins that have been transferred at the beginning of the call. See the init_call method.

§Returns

The amount of coins

source§

fn generate_event(&self, data: String) -> Result<()>

Emits an execution event to be stored.

§Arguments:

data: the string data that is the payload of the event

source§

fn generate_event_wasmv1(&self, data: Vec<u8>) -> Result<()>

Emits an execution event to be stored.

§Arguments:

data: the bytes_array data that is the payload of the event

source§

fn get_time(&self) -> Result<u64>

Returns the current time (millisecond UNIX timestamp) Note that in order to ensure determinism, this is actually the time of the context slot.

source§

fn unsafe_random(&self) -> Result<i64>

Returns a pseudo-random deterministic i64 number

§Warning

This random number generator is unsafe: it can be both predicted and manipulated before the execution

[DeprecatedByNewRuntime] Replaced by unsafe_random_wasmv1

source§

fn unsafe_random_f64(&self) -> Result<f64>

Returns a pseudo-random deterministic f64 number

§Warning

This random number generator is unsafe: it can be both predicted and manipulated before the execution

[DeprecatedByNewRuntime] Replaced by unsafe_random_wasmv1

source§

fn unsafe_random_wasmv1(&self, num_bytes: u64) -> Result<Vec<u8>>

Returns a pseudo-random deterministic byte array, with the given number of bytes

§Warning

This random number generator is unsafe: it can be both predicted and manipulated before the execution

source§

fn send_message( &self, target_address: &str, target_function: &str, validity_start: (u64, u8), validity_end: (u64, u8), max_gas: u64, raw_fee: u64, raw_coins: u64, data: &[u8], filter: Option<(&str, Option<&[u8]>)>, ) -> Result<()>

Adds an asynchronous message to the context speculative asynchronous pool

§Arguments
  • target_address: Destination address hash in format string
  • target_function: Name of the message handling function
  • validity_start: Tuple containing the period and thread of the validity start slot
  • validity_end: Tuple containing the period and thread of the validity end slot
  • max_gas: Maximum gas for the message execution
  • fee: Fee to pay
  • raw_coins: Coins given by the sender
  • data: Message data
source§

fn get_current_period(&self) -> Result<u64>

Returns the period of the current execution slot

[DeprecatedByNewRuntime] Replaced by get_current_slot

source§

fn get_current_thread(&self) -> Result<u8>

Returns the thread of the current execution slot

[DeprecatedByNewRuntime] Replaced by get_current_slot

source§

fn get_current_slot(&self) -> Result<Slot>

Returns the current execution slot

source§

fn raw_set_bytecode(&self, bytecode: &[u8]) -> Result<()>

Sets the bytecode of the current address

[DeprecatedByNewRuntime] Replaced by raw_set_bytecode_wasmv1

source§

fn raw_set_bytecode_for(&self, address: &str, bytecode: &[u8]) -> Result<()>

Sets the bytecode of an arbitrary address. Fails if the address does not exist, is an user address, or if the context doesn’t have write access rights on it.

[DeprecatedByNewRuntime] Replaced by raw_set_bytecode_wasmv1

source§

fn set_bytecode_wasmv1( &self, bytecode: &[u8], address: Option<String>, ) -> Result<()>

Sets the bytecode of an arbitrary address, or the current address if not provided. Fails if the address does not exist, is an user address, or if the context doesn’t have write access rights on it.

source§

fn hash_sha256(&self, bytes: &[u8]) -> Result<[u8; 32]>

Hashes givens byte array with sha256

§Arguments
  • bytes: byte array to hash
§Returns

The byte array of the resulting hash

source§

fn hash_blake3(&self, bytes: &[u8]) -> Result<[u8; 32]>

Hashes givens byte array with blake3

§Arguments
  • bytes: byte array to hash
§Returns

The byte array of the resulting hash

source§

fn get_deferred_call_quote( &self, target_slot: (u64, u8), gas_limit: u64, params_size: u64, ) -> Result<(bool, u64)>

Get the number of fees needed to reserve space in the target slot

§Arguments
  • target_slot: tuple containing the period and thread of the target slot
  • gas_limit: the gas limit for the call
§Returns

A tuple containing a boolean indicating if the call is possible and the amount of fees needed

source§

fn deferred_call_register( &self, target_addr: &str, target_func: &str, target_slot: (u64, u8), max_gas: u64, params: &[u8], coins: u64, ) -> Result<String>

Register deferred call

§Arguments
  • target_addr: string representation of the target address
  • target_func: string representation of the target function
  • target_slot: tuple containing the period and thread of the target slot
  • max_gas: the gas limit for the call
  • coins: the amount of coins to send
  • params: byte array of the parameters
§Returns

The id of the call

source§

fn deferred_call_exists(&self, id: &str) -> Result<bool>

Check if an deferred call exists

§Arguments
  • id: the id of the call
§Returns

true if the call exists, false otherwise

source§

fn deferred_call_cancel(&self, id: &str) -> Result<()>

Cancel a deferred call

§Arguments
  • id: the id of the call
source§

fn native_amount_from_str_wasmv1(&self, amount: &str) -> Result<NativeAmount>

Returns a NativeAmount from a string

source§

fn native_amount_to_string_wasmv1( &self, amount: &NativeAmount, ) -> Result<String>

Returns a string from a NativeAmount

source§

fn check_native_amount_wasmv1(&self, amount: &NativeAmount) -> Result<bool>

Checks if the given native amount is valid

source§

fn add_native_amount_wasmv1( &self, amount1: &NativeAmount, amount2: &NativeAmount, ) -> Result<NativeAmount>

Adds two native amounts, saturating at the numeric bounds instead of overflowing.

source§

fn sub_native_amount_wasmv1( &self, amount1: &NativeAmount, amount2: &NativeAmount, ) -> Result<NativeAmount>

Subtracts two native amounts, saturating at the numeric bounds instead of overflowing.

source§

fn scalar_mul_native_amount_wasmv1( &self, amount: &NativeAmount, factor: u64, ) -> Result<NativeAmount>

Multiplies a native amount by a factor, saturating at the numeric bounds instead of overflowing.

source§

fn scalar_div_rem_native_amount_wasmv1( &self, dividend: &NativeAmount, divisor: u64, ) -> Result<(NativeAmount, NativeAmount)>

Divides a native amount by a divisor, return an error if the divisor is 0.

source§

fn div_rem_native_amount_wasmv1( &self, dividend: &NativeAmount, divisor: &NativeAmount, ) -> Result<(u64, NativeAmount)>

Divides a native amount by a divisor, return an error if the divisor is 0.

source§

fn save_gas_remaining_before_subexecution(&self, gas_remaining: u64)

Try to get a write lock on the execution context then set the gas_used_until_the_last_subexecution field to the given gas_remaining value.

If the context is locked, this function does nothing but log a warning.

source§

fn get_interface_version(&self) -> Result<u32>

source§

fn increment_recursion_counter(&self) -> Result<()>

source§

fn decrement_recursion_counter(&self) -> Result<()>

source§

fn set_ds_value_wasmv1( &self, key: &[u8], value: &[u8], address: Option<String>, ) -> Result<()>

source§

fn validate_address(&self, address: &str) -> Result<bool>

Validate an address
source§

fn is_address_eoa(&self, address_: &str) -> Result<bool>

Return true if the address is a User address, false if it is an SC address
source§

fn get_origin_operation_id(&self) -> Result<Option<String>>

source§

fn init_call_wasmv1( &self, address: &str, raw_coins: NativeAmount, ) -> Result<Vec<u8>>

Prepare the execution of a module at the given address and transfer a given amount of coins
source§

fn base58_check_to_bytes_wasmv1(&self, s: &str) -> Result<Vec<u8>>

source§

fn bytes_to_base58_check_wasmv1(&self, data: &[u8]) -> String

source§

fn check_address_wasmv1(&self, to_check: &str) -> Result<bool>

source§

fn check_pubkey_wasmv1(&self, to_check: &str) -> Result<bool>

source§

fn check_signature_wasmv1(&self, to_check: &str) -> Result<bool>

source§

fn get_address_category_wasmv1(&self, to_check: &str) -> Result<AddressCategory>

source§

fn get_address_version_wasmv1(&self, address: &str) -> Result<u64>

source§

fn get_pubkey_version_wasmv1(&self, pubkey: &str) -> Result<u64>

source§

fn get_signature_version_wasmv1(&self, signature: &str) -> Result<u64>

source§

fn checked_add_native_time_wasmv1( &self, time1: &NativeTime, time2: &NativeTime, ) -> Result<NativeTime>

source§

fn checked_sub_native_time_wasmv1( &self, time1: &NativeTime, time2: &NativeTime, ) -> Result<NativeTime>

source§

fn checked_mul_native_time_wasmv1( &self, time: &NativeTime, factor: u64, ) -> Result<NativeTime>

source§

fn checked_scalar_div_native_time_wasmv1( &self, dividend: &NativeTime, divisor: u64, ) -> Result<(NativeTime, NativeTime)>

source§

fn checked_div_native_time_wasmv1( &self, dividend: &NativeTime, divisor: &NativeTime, ) -> Result<(u64, NativeTime)>

source§

fn compare_address_wasmv1( &self, left: &str, right: &str, ) -> Result<ComparisonResult>

source§

fn compare_native_amount_wasmv1( &self, left: &NativeAmount, right: &NativeAmount, ) -> Result<ComparisonResult>

source§

fn compare_native_time_wasmv1( &self, left: &NativeTime, right: &NativeTime, ) -> Result<ComparisonResult>

source§

fn compare_pub_key_wasmv1( &self, left: &str, right: &str, ) -> Result<ComparisonResult>

source§

fn chain_id(&self) -> Result<u64>

source§

impl InterfaceClone for InterfaceImpl

source§

fn clone_box(&self) -> Box<dyn Interface>

allows cloning a boxed InterfaceImpl

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> DynClone for T
where T: Clone,

§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<T> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T