Struct casper_execution_engine::core::runtime::Runtime
source · pub struct Runtime<'a, R> { /* private fields */ }
Expand description
Represents the runtime properties of a WASM execution.
Implementations§
source§impl<'a, R> Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
sourcepub fn call_contract(
&mut self,
contract_hash: ContractHash,
entry_point_name: &str,
args: RuntimeArgs
) -> Result<CLValue, Error>
pub fn call_contract( &mut self, contract_hash: ContractHash, entry_point_name: &str, args: RuntimeArgs ) -> Result<CLValue, Error>
Calls contract living under a key
, with supplied args
.
sourcepub fn call_versioned_contract(
&mut self,
contract_package_hash: ContractPackageHash,
contract_version: Option<ContractVersion>,
entry_point_name: String,
args: RuntimeArgs
) -> Result<CLValue, Error>
pub fn call_versioned_contract( &mut self, contract_package_hash: ContractPackageHash, contract_version: Option<ContractVersion>, entry_point_name: String, args: RuntimeArgs ) -> Result<CLValue, Error>
Calls version
of the contract living at key
, invoking method
with
supplied args
. This function also checks the args conform with the
types given in the contract header.
sourcepub fn take_host_buffer(&mut self) -> Option<CLValue>
pub fn take_host_buffer(&mut self) -> Option<CLValue>
If host_buffer set, clears the host_buffer and returns value, else None
Trait Implementations§
source§impl<'a, R> AccountProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> AccountProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§impl<'a, R> AccountProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> AccountProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§impl<'a, R> Auction for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> Auction for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn get_era_validators(
&mut self
) -> Result<BTreeMap<EraId, BTreeMap<PublicKey, U512, Global>, Global>, Error>
fn get_era_validators( &mut self ) -> Result<BTreeMap<EraId, BTreeMap<PublicKey, U512, Global>, Global>, Error>
Returns active validators and auction winners for a number of future eras determined by the
configured auction_delay.
source§fn read_seigniorage_recipients(
&mut self
) -> Result<BTreeMap<PublicKey, SeigniorageRecipient, Global>, Error>
fn read_seigniorage_recipients( &mut self ) -> Result<BTreeMap<PublicKey, SeigniorageRecipient, Global>, Error>
Returns validators in era_validators, mapped to their bids or founding stakes, delegation
rates and lists of delegators together with their delegated quantities from delegators.
This function is publicly accessible, but intended for system use by the Handle Payment
contract, because this data is necessary for distributing seigniorage.
source§fn add_bid(
&mut self,
public_key: PublicKey,
delegation_rate: u8,
amount: U512
) -> Result<U512, ApiError>
fn add_bid( &mut self, public_key: PublicKey, delegation_rate: u8, amount: U512 ) -> Result<U512, ApiError>
This entry point adds or modifies an entry in the
Key::Bid
section of the global state and
creates (or tops off) a bid purse. Post genesis, any new call on this entry point causes a
non-founding validator in the system to exist. Read moresource§fn withdraw_bid(
&mut self,
public_key: PublicKey,
amount: U512
) -> Result<U512, Error>
fn withdraw_bid( &mut self, public_key: PublicKey, amount: U512 ) -> Result<U512, Error>
For a non-founder validator, this method simply decreases a stake. Read more
source§fn delegate(
&mut self,
delegator_public_key: PublicKey,
validator_public_key: PublicKey,
amount: U512,
max_delegator_size_limit: usize,
minimum_delegation_amount: u64
) -> Result<U512, ApiError>
fn delegate( &mut self, delegator_public_key: PublicKey, validator_public_key: PublicKey, amount: U512, max_delegator_size_limit: usize, minimum_delegation_amount: u64 ) -> Result<U512, ApiError>
Adds a new delegator to delegators or increases its current stake. If the target validator
is missing, the function call returns an error and does nothing. Read more
source§fn undelegate(
&mut self,
delegator_public_key: PublicKey,
validator_public_key: PublicKey,
amount: U512
) -> Result<U512, Error>
fn undelegate( &mut self, delegator_public_key: PublicKey, validator_public_key: PublicKey, amount: U512 ) -> Result<U512, Error>
Removes specified amount of motes (or the value from the collection altogether, if the
remaining amount is 0) from the entry in delegators map for given validator and creates a
new unbonding request to the queue. Read more
source§fn slash(
&mut self,
validator_public_keys: Vec<PublicKey, Global>
) -> Result<(), Error>
fn slash( &mut self, validator_public_keys: Vec<PublicKey, Global> ) -> Result<(), Error>
Slashes each validator. Read more
source§fn run_auction(
&mut self,
era_end_timestamp_millis: u64,
evicted_validators: Vec<PublicKey, Global>
) -> Result<(), Error>
fn run_auction( &mut self, era_end_timestamp_millis: u64, evicted_validators: Vec<PublicKey, Global> ) -> Result<(), Error>
Takes active_bids and delegators to construct a list of validators’ total bids (their own
added to their delegators’) ordered by size from largest to smallest, then takes the top N
(number of auction slots) bidders and replaces era_validators with these. Read more
source§impl<'a, R> Externals for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> Externals for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn invoke_index(
&mut self,
index: usize,
args: RuntimeArgs<'_>
) -> Result<Option<RuntimeValue>, Trap>
fn invoke_index( &mut self, index: usize, args: RuntimeArgs<'_> ) -> Result<Option<RuntimeValue>, Trap>
Perform invoke of a host function by specified
index
.source§impl<'a, R> HandlePayment for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> HandlePayment for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn finalize_payment(
&mut self,
amount_spent: U512,
account: AccountHash,
target: URef
) -> Result<(), Error>
fn finalize_payment( &mut self, amount_spent: U512, account: AccountHash, target: URef ) -> Result<(), Error>
Finalize payment with
amount_spent
and a given account
.source§impl<'a, R> HandlePaymentProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> HandlePaymentProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§impl<'a, R> Mint for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> Mint for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn mint(&mut self, initial_balance: U512) -> Result<URef, Error>
fn mint(&mut self, initial_balance: U512) -> Result<URef, Error>
Mint new token with given
initial_balance
balance. Returns new purse on success, otherwise
an error.source§fn reduce_total_supply(&mut self, amount: U512) -> Result<(), Error>
fn reduce_total_supply(&mut self, amount: U512) -> Result<(), Error>
Reduce total supply by
amount
. Returns unit on success, otherwise
an error.source§fn balance(&mut self, purse: URef) -> Result<Option<U512>, Error>
fn balance(&mut self, purse: URef) -> Result<Option<U512>, Error>
Read balance of given
purse
.source§impl<'a, R> MintProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> MintProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§impl<'a, R> MintProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> MintProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn transfer_purse_to_account(
&mut self,
source: URef,
target: AccountHash,
amount: U512
) -> Result<TransferredTo, Error>
fn transfer_purse_to_account( &mut self, source: URef, target: AccountHash, amount: U512 ) -> Result<TransferredTo, Error>
Transfer
amount
from source
purse to a target
account.source§impl<'a, R> MintProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> MintProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn mint_transfer_direct(
&mut self,
to: Option<AccountHash>,
source: URef,
target: URef,
amount: U512,
id: Option<u64>
) -> Result<Result<(), Error>, Error>
fn mint_transfer_direct( &mut self, to: Option<AccountHash>, source: URef, target: URef, amount: U512, id: Option<u64> ) -> Result<Result<(), Error>, Error>
Allows optimized auction and mint interaction. Intended to be used only by system contracts to manage staked purses. NOTE: Never expose this through FFI.
source§fn unbond(&mut self, unbonding_purse: &UnbondingPurse) -> Result<(), Error>
fn unbond(&mut self, unbonding_purse: &UnbondingPurse) -> Result<(), Error>
Returns successfully unbonded stake to origin account.
source§fn mint_into_existing_purse(
&mut self,
amount: U512,
existing_purse: URef
) -> Result<(), Error>
fn mint_into_existing_purse( &mut self, amount: U512, existing_purse: URef ) -> Result<(), Error>
Mint
amount
new token into existing_purse
.
Returns unit on success, otherwise an error.source§impl<'a, R> RuntimeProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> RuntimeProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn get_block_time(&self) -> BlockTime
fn get_block_time(&self) -> BlockTime
Get current block time.
source§fn get_caller(&self) -> AccountHash
fn get_caller(&self) -> AccountHash
Get caller.
source§impl<'a, R> RuntimeProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> RuntimeProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn get_caller(&self) -> AccountHash
fn get_caller(&self) -> AccountHash
This method should return the caller of the current context.
source§fn get_immediate_caller(&self) -> Option<&CallStackElement>
fn get_immediate_caller(&self) -> Option<&CallStackElement>
This method should return the immediate caller of the current context.
source§fn put_key(&mut self, name: &str, key: Key) -> Result<(), Error>
fn put_key(&mut self, name: &str, key: Key) -> Result<(), Error>
This method should handle storing given
Key
under name
.source§fn get_key(&self, name: &str) -> Option<Key>
fn get_key(&self, name: &str) -> Option<Key>
This method should handle obtaining a given named
Key
under a name
.source§fn get_approved_spending_limit(&self) -> U512
fn get_approved_spending_limit(&self) -> U512
Returns approved CSPR spending limit.
source§fn sub_approved_spending_limit(&mut self, transferred: U512)
fn sub_approved_spending_limit(&mut self, transferred: U512)
Signal to host that
transferred
amount of tokens has been transferred.source§fn get_main_purse(&self) -> URef
fn get_main_purse(&self) -> URef
Returns main purse of the sender account.
source§impl<'a, R> RuntimeProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> RuntimeProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn get_caller(&self) -> AccountHash
fn get_caller(&self) -> AccountHash
This method should return the caller of the current context.
source§fn is_allowed_session_caller(&self, account_hash: &AccountHash) -> bool
fn is_allowed_session_caller(&self, account_hash: &AccountHash) -> bool
Checks if account_hash matches the active session’s account.
source§impl<'a, R> StandardPayment for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> StandardPayment for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§impl<'a, R> StorageProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> StorageProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn read<T: FromBytes + CLTyped>(
&mut self,
uref: URef
) -> Result<Option<T>, Error>
fn read<T: FromBytes + CLTyped>( &mut self, uref: URef ) -> Result<Option<T>, Error>
Reads data from
URef
.source§fn write<T: ToBytes + CLTyped>(
&mut self,
uref: URef,
value: T
) -> Result<(), Error>
fn write<T: ToBytes + CLTyped>( &mut self, uref: URef, value: T ) -> Result<(), Error>
Writes data to `URef.
source§fn write_seigniorage_recipients_snapshot(
&mut self,
uref: URef,
snapshot: SeigniorageRecipientsSnapshot
) -> Result<(), Error>
fn write_seigniorage_recipients_snapshot( &mut self, uref: URef, snapshot: SeigniorageRecipientsSnapshot ) -> Result<(), Error>
Writes a
SeigniorageRecipientsSnapshot
to global state and charges for bytes stored. Read moresource§fn read_bid(&mut self, account_hash: &AccountHash) -> Result<Option<Bid>, Error>
fn read_bid(&mut self, account_hash: &AccountHash) -> Result<Option<Bid>, Error>
Reads
Bid
at account hash derived from given public keysource§fn write_bid(
&mut self,
account_hash: AccountHash,
bid: Bid
) -> Result<(), Error>
fn write_bid( &mut self, account_hash: AccountHash, bid: Bid ) -> Result<(), Error>
Writes given
Bid
at account hash derived from given public keysource§fn read_withdraw(
&mut self,
account_hash: &AccountHash
) -> Result<Vec<UnbondingPurse>, Error>
fn read_withdraw( &mut self, account_hash: &AccountHash ) -> Result<Vec<UnbondingPurse>, Error>
Reads collection of
UnbondingPurse
s at account hash derived from given public keysource§fn write_withdraw(
&mut self,
account_hash: AccountHash,
unbonding_purses: Vec<UnbondingPurse>
) -> Result<(), Error>
fn write_withdraw( &mut self, account_hash: AccountHash, unbonding_purses: Vec<UnbondingPurse> ) -> Result<(), Error>
Writes given
UnbondingPurse
s at account hash derived from given public keysource§impl<'a, R> StorageProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> StorageProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
source§fn read<T: CLTyped + FromBytes>(
&mut self,
uref: URef
) -> Result<Option<T>, Error>
fn read<T: CLTyped + FromBytes>( &mut self, uref: URef ) -> Result<Option<T>, Error>
Read data from
URef
.source§fn write<T: CLTyped + ToBytes>(
&mut self,
uref: URef,
value: T
) -> Result<(), Error>
fn write<T: CLTyped + ToBytes>( &mut self, uref: URef, value: T ) -> Result<(), Error>
Write data under a
URef
.source§impl<'a, R> SystemProvider for Runtime<'a, R>where
R: StateReader<Key, StoredValue>,
R::Error: Into<Error>,
impl<'a, R> SystemProvider for Runtime<'a, R>where R: StateReader<Key, StoredValue>, R::Error: Into<Error>,
Auto Trait Implementations§
impl<'a, R> !RefUnwindSafe for Runtime<'a, R>
impl<'a, R> !Send for Runtime<'a, R>
impl<'a, R> !Sync for Runtime<'a, R>
impl<'a, R> Unpin for Runtime<'a, R>
impl<'a, R> !UnwindSafe for Runtime<'a, R>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Conv for T
impl<T> Conv for T
§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.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
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,
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,
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,
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,
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,
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,
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,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for T
impl<T> Pipe for T
§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
§impl<T> PipeDeref for T
impl<T> PipeDeref for T
§impl<T> PipeRef for T
impl<T> PipeRef for T
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
Pipes a reference into a function that cannot ordinarily be called in
suffix position. Read more
§fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
Pipes a mutable reference into a function that cannot ordinarily be
called in suffix position. Read more
§impl<T> Tap for T
impl<T> Tap for T
§fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
Provides immutable access for inspection. Read more
§fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
Calls
tap
in debug builds, and does nothing in release builds.§fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
Provides mutable access for modification. Read more
§fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
Calls
tap_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere U: ?Sized,
§fn tap_ref<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
Provides immutable access to the reference for inspection.
§fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
Calls
tap_ref
in debug builds, and does nothing in release builds.§fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
Provides mutable access to the reference for modification.
§fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
Calls
tap_ref_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere U: ?Sized,
§fn tap_borrow<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
Provides immutable access to the borrow for inspection. Read more
§fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
Calls
tap_borrow
in debug builds, and does nothing in release builds.§fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
Provides mutable access to the borrow for modification.
§fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
Calls
tap_borrow_mut
in debug builds, and does nothing in release
builds.§impl<T> TapDeref for T
impl<T> TapDeref for T
§fn tap_deref<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
Immutably dereferences
self
for inspection.§fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
Calls
tap_deref
in debug builds, and does nothing in release builds.§fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
Mutably dereferences
self
for modification.§fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
Calls
tap_deref_mut
in debug builds, and does nothing in release
builds.