Struct darwinia_balances::pallet::Pallet
source · [−]pub struct Pallet<T, I = ()>(_);
Expand description
The pallet implementing the on-chain logic.
Implementations
sourceimpl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
sourcepub fn transfer(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
pub fn transfer(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
Transfer some liquid free balance to another account.
transfer
will set the FreeBalance
of the sender and receiver.
If the sender’s account is below the existential deposit as a result
of the transfer, the account will be reaped.
The dispatch origin for this call must be Signed
by the transactor.
- Dependent on arguments but not critical, given proper implementations for input config types. See related functions below.
- It contains a limited number of reads and writes internally and no complex computation.
Related functions:
ensure_can_withdraw
is always called internally but has a bounded complexity.- Transferring balances to accounts that did not exist before will cause
T::OnNewAccount::on_new_account
to be called. - Removing enough funds from an account will trigger
T::DustRemoval::on_unbalanced
. transfer_keep_alive
works the same way astransfer
, but has an additional check that the transfer will not kill the origin account.
sourcepub fn set_balance(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
new_free: T::Balance,
new_reserved: T::Balance
) -> DispatchResultWithPostInfo
pub fn set_balance(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
new_free: T::Balance,
new_reserved: T::Balance
) -> DispatchResultWithPostInfo
Set the balances of a given account.
This will alter FreeBalance
and ReservedBalance
in storage. it will
also alter the total issuance of the system (TotalIssuance
) appropriately.
If the new free or reserved balance is below the existential deposit,
it will reset the account nonce (frame_system::AccountNonce
).
The dispatch origin for this call is root
.
sourcepub fn force_transfer(
origin: OriginFor<T>,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
pub fn force_transfer(
origin: OriginFor<T>,
source: <T::Lookup as StaticLookup>::Source,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
sourcepub fn transfer_keep_alive(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
pub fn transfer_keep_alive(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
) -> DispatchResultWithPostInfo
sourcepub fn transfer_all(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
keep_alive: bool
) -> DispatchResult
pub fn transfer_all(
origin: OriginFor<T>,
dest: <T::Lookup as StaticLookup>::Source,
keep_alive: bool
) -> DispatchResult
Transfer the entire transferable balance from the caller account.
NOTE: This function only attempts to transfer transferable balances. This means that
any locked, reserved, or existential deposits (when keep_alive
is true
), will not be
transferred by this function. To ensure that this function results in a killed account,
you might need to prepare the account by removing any reference counters, storage
deposits, etc…
The dispatch origin of this call must be Signed.
dest
: The recipient of the transfer.keep_alive
: A boolean to determine if thetransfer_all
operation should send all of the funds the account has, causing the sender account to be killed (false), or transfer everything except at least the existential deposit, which will guarantee to keep the sender account alive (true). #- O(1). Just like transfer, but reading the user’s transferable balance first. #
sourcepub fn force_unreserve(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
pub fn force_unreserve(
origin: OriginFor<T>,
who: <T::Lookup as StaticLookup>::Source,
amount: T::Balance
) -> DispatchResult
Unreserve some balance from a user by force.
Can only be called by ROOT.
sourceimpl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
sourcepub fn free_balance(who: impl Borrow<T::AccountId>) -> T::Balance
pub fn free_balance(who: impl Borrow<T::AccountId>) -> T::Balance
Get the free balance of an account.
sourcepub fn frozen_balance(
who: impl Borrow<T::AccountId>
) -> FrozenBalance<T::Balance>
pub fn frozen_balance(
who: impl Borrow<T::AccountId>
) -> FrozenBalance<T::Balance>
Get the frozen balance of an account.
sourcepub fn reserved_balance(who: impl Borrow<T::AccountId>) -> T::Balance
pub fn reserved_balance(who: impl Borrow<T::AccountId>) -> T::Balance
Get the reserved balance of an account.
sourcepub fn account(who: &T::AccountId) -> T::BalanceInfo
pub fn account(who: &T::AccountId) -> T::BalanceInfo
Get both the free and reserved balances of an account.
sourcepub fn mutate_account<R>(
who: &T::AccountId,
f: impl FnOnce(&mut T::BalanceInfo) -> R
) -> Result<R, DispatchError>
pub fn mutate_account<R>(
who: &T::AccountId,
f: impl FnOnce(&mut T::BalanceInfo) -> R
) -> Result<R, DispatchError>
Mutate an account to some new value, or delete it entirely with None
. Will enforce
ExistentialDeposit
law, annulling the account as needed.
NOTE: Doesn’t do any preparatory work for creating a new account, so should only be used when it is known that the account already exists.
NOTE: LOW-LEVEL: This will not attempt to maintain total issuance. It is expected that the caller will do this.
sourceimpl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
pub fn error_metadata() -> Option<PalletErrorMetadata>
sourceimpl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
sourcepub fn total_issuance() -> T::Balance
pub fn total_issuance() -> T::Balance
The total units issued in the system.
sourceimpl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
sourcepub fn locks<KArg>(
k: KArg
) -> WeakBoundedVec<BalanceLock<T::Balance>, T::MaxLocks> where
KArg: EncodeLike<T::AccountId>,
pub fn locks<KArg>(
k: KArg
) -> WeakBoundedVec<BalanceLock<T::Balance>, T::MaxLocks> where
KArg: EncodeLike<T::AccountId>,
Any liquidity locks on some account balances. NOTE: Should only be accessed when setting, changing and freeing a lock.
sourceimpl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
sourcepub fn reserves<KArg>(
k: KArg
) -> BoundedVec<ReserveData<T::ReserveIdentifier, T::Balance>, T::MaxReserves> where
KArg: EncodeLike<T::AccountId>,
pub fn reserves<KArg>(
k: KArg
) -> BoundedVec<ReserveData<T::ReserveIdentifier, T::Balance>, T::MaxReserves> where
KArg: EncodeLike<T::AccountId>,
Named reserves on some account balances.
Trait Implementations
sourceimpl<T: Config<I>, I: 'static> Currency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
impl<T: Config<I>, I: 'static> Currency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
sourcefn slash(
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
fn slash(
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
Slash a target account who
, returning the negative imbalance created and any left over
amount that could not be slashed.
Is a no-op if value
to be slashed is zero or the account does not exist.
NOTE: slash()
prefers free balance, but assumes that reserve balance can be drawn
from in extreme circumstances. can_slash()
should be used prior to slash()
to avoid
having to draw from reserved funds, however we err on the side of punishment if things
are inconsistent or can_slash
wasn’t used appropriately.
sourcefn deposit_into_existing(
who: &T::AccountId,
value: Self::Balance
) -> Result<Self::PositiveImbalance, DispatchError>
fn deposit_into_existing(
who: &T::AccountId,
value: Self::Balance
) -> Result<Self::PositiveImbalance, DispatchError>
Deposit some value
into the free balance of an existing target account who
.
Is a no-op if the value
to be deposited is zero.
sourcefn deposit_creating(
who: &T::AccountId,
value: Self::Balance
) -> Self::PositiveImbalance
fn deposit_creating(
who: &T::AccountId,
value: Self::Balance
) -> Self::PositiveImbalance
Deposit some value
into the free balance of who
, possibly creating a new account.
This function is a no-op if:
- the
value
to be deposited is zero; or - the
value
to be deposited is less than the required ED and the account does not yet exist; or - the deposit would necessitate the account to exist and there are no provider references; or
value
is so large it would cause the balance ofwho
to overflow.
sourcefn withdraw(
who: &T::AccountId,
value: Self::Balance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<Self::NegativeImbalance, DispatchError>
fn withdraw(
who: &T::AccountId,
value: Self::Balance,
reasons: WithdrawReasons,
liveness: ExistenceRequirement
) -> Result<Self::NegativeImbalance, DispatchError>
Withdraw some free balance from an account, respecting existence requirements.
Is a no-op if value to be withdrawn is zero.
sourcefn make_free_balance_be(
who: &T::AccountId,
value: Self::Balance
) -> SignedImbalance<Self::Balance, Self::PositiveImbalance>
fn make_free_balance_be(
who: &T::AccountId,
value: Self::Balance
) -> SignedImbalance<Self::Balance, Self::PositiveImbalance>
Force the new free balance of a target account who
to some new value balance
.
type NegativeImbalance = NegativeImbalance<T, I>
type NegativeImbalance = NegativeImbalance<T, I>
The opaque token type for an imbalance. This is returned by unbalanced operations and must be dealt with. It may be dropped but cannot be cloned. Read more
type PositiveImbalance = PositiveImbalance<T, I>
type PositiveImbalance = PositiveImbalance<T, I>
The opaque token type for an imbalance. This is returned by unbalanced operations and must be dealt with. It may be dropped but cannot be cloned. Read more
sourcefn total_balance(who: &T::AccountId) -> Self::Balance
fn total_balance(who: &T::AccountId) -> Self::Balance
The combined balance of who
.
sourcefn can_slash(who: &T::AccountId, value: Self::Balance) -> bool
fn can_slash(who: &T::AccountId, value: Self::Balance) -> bool
Same result as slash(who, value)
(but without the side-effects) assuming there are no
balance changes in the meantime and only the reserved balance is not taken into account. Read more
sourcefn total_issuance() -> Self::Balance
fn total_issuance() -> Self::Balance
The total amount of issuance in the system.
sourcefn minimum_balance() -> Self::Balance
fn minimum_balance() -> Self::Balance
The minimum balance any single account may have. This is equivalent to the Balances
module’s ExistentialDeposit
. Read more
sourcefn burn(amount: Self::Balance) -> Self::PositiveImbalance
fn burn(amount: Self::Balance) -> Self::PositiveImbalance
Reduce the total issuance by amount
and return the according imbalance. The imbalance will
typically be used to reduce an account by the same amount with e.g. settle
. Read more
sourcefn issue(amount: Self::Balance) -> Self::NegativeImbalance
fn issue(amount: Self::Balance) -> Self::NegativeImbalance
Increase the total issuance by amount
and return the according imbalance. The imbalance
will typically be used to increase an account by the same amount with e.g.
resolve_into_existing
or resolve_creating
. Read more
sourcefn free_balance(who: &T::AccountId) -> Self::Balance
fn free_balance(who: &T::AccountId) -> Self::Balance
The ‘free’ balance of a given account. Read more
sourcefn ensure_can_withdraw(
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons,
new_balance: T::Balance
) -> DispatchResult
fn ensure_can_withdraw(
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons,
new_balance: T::Balance
) -> DispatchResult
Returns Ok
iff the account is able to make a withdrawal of the given amount
for the given reason. Basically, it’s just a dry-run of withdraw
. Read more
sourcefn transfer(
transactor: &T::AccountId,
dest: &T::AccountId,
value: Self::Balance,
existence_requirement: ExistenceRequirement
) -> DispatchResult
fn transfer(
transactor: &T::AccountId,
dest: &T::AccountId,
value: Self::Balance,
existence_requirement: ExistenceRequirement
) -> DispatchResult
Transfer some liquid free balance to another staker. Read more
fn pair(
amount: Self::Balance
) -> (Self::PositiveImbalance, Self::NegativeImbalance)
fn pair(
amount: Self::Balance
) -> (Self::PositiveImbalance, Self::NegativeImbalance)
Produce a pair of imbalances that cancel each other out exactly. Read more
fn resolve_into_existing(
who: &AccountId,
value: Self::NegativeImbalance
) -> Result<(), Self::NegativeImbalance>
fn resolve_into_existing(
who: &AccountId,
value: Self::NegativeImbalance
) -> Result<(), Self::NegativeImbalance>
Similar to deposit_creating, only accepts a NegativeImbalance
and returns nothing on
success. Read more
fn resolve_creating(who: &AccountId, value: Self::NegativeImbalance)
fn resolve_creating(who: &AccountId, value: Self::NegativeImbalance)
Similar to deposit_creating, only accepts a NegativeImbalance
and returns nothing on
success. Read more
sourceimpl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>
impl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>
sourcefn current_storage_version() -> StorageVersion
fn current_storage_version() -> StorageVersion
Returns the current storage version as supported by the pallet.
sourcefn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
Returns the on-chain storage version of the pallet as stored in the storage.
sourceimpl<T: Config<I>, I: 'static> Hooks<<T as Config>::BlockNumber> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Hooks<<T as Config>::BlockNumber> for Pallet<T, I>
fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
The block is being finalized. Implement to have something happen.
fn on_idle(_n: BlockNumber, _remaining_weight: u64) -> u64
fn on_idle(_n: BlockNumber, _remaining_weight: u64) -> u64
This will be run when the block is being finalized (before on_finalize
).
Implement to have something happen using the remaining weight.
Will not fire if the remaining weight is 0.
Return the weight used, the hook will subtract it from current weight used
and pass the result to the next on_idle
hook if it exists. Read more
fn on_initialize(_n: BlockNumber) -> u64
fn on_initialize(_n: BlockNumber) -> u64
The block is being initialized. Implement to have something happen. Read more
fn on_runtime_upgrade() -> u64
fn on_runtime_upgrade() -> u64
Perform a module upgrade. Read more
fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
Implementing this function on a module allows you to perform long-running tasks that make (by default) validators generate transactions that feed results of those long-running computations back on chain. Read more
fn integrity_test()
fn integrity_test()
Run integrity test. Read more
sourceimpl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Inspect<<T as Config>::AccountId> for Pallet<T, I>
sourcefn total_issuance() -> Self::Balance
fn total_issuance() -> Self::Balance
The total amount of issuance in the system.
sourcefn minimum_balance() -> Self::Balance
fn minimum_balance() -> Self::Balance
The minimum balance any single account may have.
sourcefn reducible_balance(who: &T::AccountId, keep_alive: bool) -> Self::Balance
fn reducible_balance(who: &T::AccountId, keep_alive: bool) -> Self::Balance
Get the maximum amount that who
can withdraw/transfer successfully.
sourcefn can_deposit(who: &T::AccountId, amount: Self::Balance) -> DepositConsequence
fn can_deposit(who: &T::AccountId, amount: Self::Balance) -> DepositConsequence
Returns true
if the balance of who
may be increased by amount
.
sourcefn can_withdraw(
who: &T::AccountId,
amount: Self::Balance
) -> WithdrawConsequence<Self::Balance>
fn can_withdraw(
who: &T::AccountId,
amount: Self::Balance
) -> WithdrawConsequence<Self::Balance>
Returns Failed
if the balance of who
may not be decreased by amount
, otherwise
the consequence. Read more
sourceimpl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
sourcefn integrity_test()
fn integrity_test()
Run integrity test. Read more
sourceimpl<T: Config<I>, I: 'static> LockableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
impl<T: Config<I>, I: 'static> LockableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
type MaxLocks = <T as Config<I>>::MaxLocks
type MaxLocks = <T as Config<I>>::MaxLocks
The maximum number of locks a user should have on their account.
type Moment = <T as Config>::BlockNumber
type Moment = <T as Config>::BlockNumber
The quantity used to denote time; usually just a BlockNumber
.
sourcefn set_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
fn set_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
Create a new balance lock on account who
. Read more
sourcefn extend_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
fn extend_lock(
id: LockIdentifier,
who: &T::AccountId,
amount: T::Balance,
reasons: WithdrawReasons
)
Changes a balance lock (selected by id
) so that it becomes less liquid in all
parameters or creates a new one if it does not exist. Read more
sourcefn remove_lock(id: LockIdentifier, who: &T::AccountId)
fn remove_lock(id: LockIdentifier, who: &T::AccountId)
Remove an existing lock.
sourceimpl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Mutate<<T as Config>::AccountId> for Pallet<T, I>
sourcefn mint_into(who: &T::AccountId, amount: Self::Balance) -> DispatchResult
fn mint_into(who: &T::AccountId, amount: Self::Balance) -> DispatchResult
Increase the balance of who
by exactly amount
, minting new tokens. If that isn’t
possible then an Err
is returned and nothing is changed. Read more
sourcefn burn_from(
who: &T::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn burn_from(
who: &T::AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Decrease the balance of who
by at least amount
, possibly slightly more in the case of
minimum_balance requirements, burning the tokens. If that isn’t possible then an Err
is
returned and nothing is changed. If successful, the amount of tokens reduced is returned. Read more
fn slash(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn slash(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Attempt to reduce the balance of who
by as much as possible up to amount
, and possibly
slightly more due to minimum_balance requirements. If no decrease is possible then an Err
is returned and nothing is changed. If successful, the amount of tokens reduced is returned. Read more
sourceimpl<T: Config<I>, I: 'static> MutateHold<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> MutateHold<<T as Config>::AccountId> for Pallet<T, I>
sourceimpl<T: Config<I>, I: 'static> NamedReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
impl<T: Config<I>, I: 'static> NamedReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
sourcefn reserve_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> DispatchResult
fn reserve_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> DispatchResult
Move value
from the free balance from who
to a named reserve balance.
Is a no-op if value to be reserved is zero.
sourcefn unreserve_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> Self::Balance
fn unreserve_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> Self::Balance
Unreserve some funds, returning any amount that was unable to be unreserved.
Is a no-op if the value to be unreserved is zero.
sourcefn slash_reserved_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
fn slash_reserved_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
Slash from reserved balance, returning the negative imbalance created, and any amount that was unable to be slashed.
Is a no-op if the value to be slashed is zero.
sourcefn repatriate_reserved_named(
id: &Self::ReserveIdentifier,
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: BalanceStatus
) -> Result<Self::Balance, DispatchError>
fn repatriate_reserved_named(
id: &Self::ReserveIdentifier,
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: BalanceStatus
) -> Result<Self::Balance, DispatchError>
Move the reserved balance of one account into the balance of another, according to
status
. If status
is Reserved
, the balance will be reserved with given id
.
Is a no-op if:
- the value to be moved is zero; or
- the
slashed
id equal tobeneficiary
and thestatus
isReserved
.
type ReserveIdentifier = <T as Config<I>>::ReserveIdentifier
type ReserveIdentifier = <T as Config<I>>::ReserveIdentifier
An identifier for a reserve. Used for disambiguating different reserves so that they can be individually replaced or removed. Read more
sourcefn reserved_balance_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId
) -> Self::Balance
fn reserved_balance_named(
id: &Self::ReserveIdentifier,
who: &T::AccountId
) -> Self::Balance
The amount of the balance of a given account that is externally reserved; this can still get slashed, but gets slashed last of all. Read more
fn ensure_reserved_named(
id: &Self::ReserveIdentifier,
who: &AccountId,
value: Self::Balance
) -> Result<(), DispatchError>
fn ensure_reserved_named(
id: &Self::ReserveIdentifier,
who: &AccountId,
value: Self::Balance
) -> Result<(), DispatchError>
Ensure the reserved balance is equal to value
. Read more
fn unreserve_all_named(
id: &Self::ReserveIdentifier,
who: &AccountId
) -> Self::Balance
fn unreserve_all_named(
id: &Self::ReserveIdentifier,
who: &AccountId
) -> Self::Balance
Unreserve all the named reserved balances, returning unreserved amount. Read more
fn slash_all_reserved_named(
id: &Self::ReserveIdentifier,
who: &AccountId
) -> Self::NegativeImbalance
fn slash_all_reserved_named(
id: &Self::ReserveIdentifier,
who: &AccountId
) -> Self::NegativeImbalance
Slash all the reserved balance, returning the negative imbalance created. Read more
fn repatriate_all_reserved_named(
id: &Self::ReserveIdentifier,
slashed: &AccountId,
beneficiary: &AccountId,
status: BalanceStatus
) -> Result<(), DispatchError>
fn repatriate_all_reserved_named(
id: &Self::ReserveIdentifier,
slashed: &AccountId,
beneficiary: &AccountId,
status: BalanceStatus
) -> Result<(), DispatchError>
Move all the named reserved balance of one account into the balance of another, according to
status
. If status
is Reserved
, the balance will be reserved with given id
. Read more
sourceimpl<T: Config<I>, I: 'static> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T, I>
sourcefn offchain_worker(n: <T as Config>::BlockNumber)
fn offchain_worker(n: <T as Config>::BlockNumber)
This function is being called after every block import (when fully synced). Read more
sourceimpl<T: Config<I>, I: 'static> OnFinalize<<T as Config>::BlockNumber> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnFinalize<<T as Config>::BlockNumber> for Pallet<T, I>
sourcefn on_finalize(n: <T as Config>::BlockNumber)
fn on_finalize(n: <T as Config>::BlockNumber)
The block is being finalized. Implement to have something happen. Read more
sourceimpl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
sourcefn on_genesis()
fn on_genesis()
Something that should happen at genesis.
sourceimpl<T: Config<I>, I: 'static> OnIdle<<T as Config>::BlockNumber> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnIdle<<T as Config>::BlockNumber> for Pallet<T, I>
sourcefn on_idle(n: <T as Config>::BlockNumber, remaining_weight: Weight) -> Weight
fn on_idle(n: <T as Config>::BlockNumber, remaining_weight: Weight) -> Weight
The block is being finalized.
Implement to have something happen in case there is leftover weight.
Check the passed remaining_weight
to make sure it is high enough to allow for
your pallet’s extra computation. Read more
sourceimpl<T: Config<I>, I: 'static> OnInitialize<<T as Config>::BlockNumber> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnInitialize<<T as Config>::BlockNumber> for Pallet<T, I>
sourcefn on_initialize(n: <T as Config>::BlockNumber) -> Weight
fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
The block is being initialized. Implement to have something happen. Read more
sourceimpl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
sourcefn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Perform a module upgrade. Read more
sourceimpl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>
impl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>
sourcefn module_name() -> &'static str
fn module_name() -> &'static str
Name of the Rust module containing the pallet.
sourcefn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
Version of the crate containing the pallet.
sourceimpl<T: Config<I>, I: 'static> PalletsInfoAccess for Pallet<T, I>
impl<T: Config<I>, I: 'static> PalletsInfoAccess for Pallet<T, I>
sourcefn accumulate(acc: &mut Vec<PalletInfoData>)
fn accumulate(acc: &mut Vec<PalletInfoData>)
Extend the given vector by all of the pallets’ information that this type represents. Read more
sourceimpl<T: Config<I>, I: 'static> ReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
impl<T: Config<I>, I: 'static> ReservableCurrency<<T as Config>::AccountId> for Pallet<T, I> where
T::Balance: MaybeSerializeDeserialize + Debug,
sourcefn can_reserve(who: &T::AccountId, value: Self::Balance) -> bool
fn can_reserve(who: &T::AccountId, value: Self::Balance) -> bool
Check if who
can reserve value
from their free balance.
Always true
if value to be reserved is zero.
sourcefn slash_reserved(
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
fn slash_reserved(
who: &T::AccountId,
value: Self::Balance
) -> (Self::NegativeImbalance, Self::Balance)
Slash from reserved balance, returning the negative imbalance created, and any amount that was unable to be slashed.
Is a no-op if the value to be slashed is zero or the account does not exist.
sourcefn reserve(who: &T::AccountId, value: Self::Balance) -> DispatchResult
fn reserve(who: &T::AccountId, value: Self::Balance) -> DispatchResult
Move value
from the free balance from who
to their reserved balance.
Is a no-op if value to be reserved is zero.
sourcefn unreserve(who: &T::AccountId, value: Self::Balance) -> Self::Balance
fn unreserve(who: &T::AccountId, value: Self::Balance) -> Self::Balance
Unreserve some funds, returning any amount that was unable to be unreserved.
Is a no-op if the value to be unreserved is zero.
sourcefn repatriate_reserved(
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: BalanceStatus
) -> Result<Self::Balance, DispatchError>
fn repatriate_reserved(
slashed: &T::AccountId,
beneficiary: &T::AccountId,
value: Self::Balance,
status: BalanceStatus
) -> Result<Self::Balance, DispatchError>
Move the reserved balance of one account into the balance of another, according to
status
.
Is a no-op if:
- the value to be moved is zero; or
- the
slashed
id equal tobeneficiary
and thestatus
isReserved
.
sourcefn reserved_balance(who: &T::AccountId) -> Self::Balance
fn reserved_balance(who: &T::AccountId) -> Self::Balance
The amount of the balance of a given account that is externally reserved; this can still get slashed, but gets slashed last of all. Read more
sourceimpl<T: Config<I>, I: 'static> Unbalanced<<T as Config>::AccountId> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Unbalanced<<T as Config>::AccountId> for Pallet<T, I>
sourcefn set_balance(who: &T::AccountId, amount: Self::Balance) -> DispatchResult
fn set_balance(who: &T::AccountId, amount: Self::Balance) -> DispatchResult
Set the balance of who
to amount
. If this cannot be done for some reason (e.g.
because the account cannot be created or an overflow) then an Err
is returned. Read more
sourcefn set_total_issuance(amount: Self::Balance)
fn set_total_issuance(amount: Self::Balance)
Set the total issuance to amount
.
fn decrease_balance(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn decrease_balance(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Reduce the balance of who
by amount
. If it cannot be reduced by that amount for
some reason, return Err
and don’t reduce it at all. If Ok, return the imbalance. Read more
fn decrease_balance_at_most(
who: &AccountId,
amount: Self::Balance
) -> Self::Balance
fn decrease_balance_at_most(
who: &AccountId,
amount: Self::Balance
) -> Self::Balance
Reduce the balance of who
by the most that is possible, up to amount
. Read more
fn increase_balance(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
fn increase_balance(
who: &AccountId,
amount: Self::Balance
) -> Result<Self::Balance, DispatchError>
Increase the balance of who
by amount
. If it cannot be increased by that amount
for some reason, return Err
and don’t increase it at all. If Ok, return the imbalance. Read more
fn increase_balance_at_most(
who: &AccountId,
amount: Self::Balance
) -> Self::Balance
fn increase_balance_at_most(
who: &AccountId,
amount: Self::Balance
) -> Self::Balance
Increase the balance of who
by the most that is possible, up to amount
. Read more
impl<T, I> Eq for Pallet<T, I>
Auto Trait Implementations
impl<T, I> RefUnwindSafe for Pallet<T, I> where
I: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, I> Send for Pallet<T, I> where
I: Send,
T: Send,
impl<T, I> Sync for Pallet<T, I> where
I: Sync,
T: Sync,
impl<T, I> Unpin for Pallet<T, I> where
I: Unpin,
T: Unpin,
impl<T, I> UnwindSafe for Pallet<T, I> where
I: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<AccountId, U> Balanced<AccountId> for U where
U: Unbalanced<AccountId>,
impl<AccountId, U> Balanced<AccountId> for U where
U: Unbalanced<AccountId>,
type OnDropCredit = DecreaseIssuance<AccountId, U>
type OnDropCredit = DecreaseIssuance<AccountId, U>
The type for managing what happens when an instance of Credit
is dropped without being
used. Read more
type OnDropDebt = IncreaseIssuance<AccountId, U>
type OnDropDebt = IncreaseIssuance<AccountId, U>
The type for managing what happens when an instance of Debt
is dropped without being used.
fn rescind(
amount: <U as Inspect<AccountId>>::Balance
) -> Imbalance<<U as Inspect<AccountId>>::Balance, IncreaseIssuance<AccountId, U>, DecreaseIssuance<AccountId, U>>
fn rescind(
amount: <U as Inspect<AccountId>>::Balance
) -> Imbalance<<U as Inspect<AccountId>>::Balance, IncreaseIssuance<AccountId, U>, DecreaseIssuance<AccountId, U>>
Reduce the total issuance by amount
and return the according imbalance. The imbalance will
typically be used to reduce an account by the same amount with e.g. settle
. Read more
fn issue(
amount: <U as Inspect<AccountId>>::Balance
) -> Imbalance<<U as Inspect<AccountId>>::Balance, DecreaseIssuance<AccountId, U>, IncreaseIssuance<AccountId, U>>
fn issue(
amount: <U as Inspect<AccountId>>::Balance
) -> Imbalance<<U as Inspect<AccountId>>::Balance, DecreaseIssuance<AccountId, U>, IncreaseIssuance<AccountId, U>>
Increase the total issuance by amount
and return the according imbalance. The imbalance
will typically be used to increase an account by the same amount with e.g.
resolve_into_existing
or resolve_creating
. Read more
fn slash(
who: &AccountId,
amount: <U as Inspect<AccountId>>::Balance
) -> (Imbalance<<U as Inspect<AccountId>>::Balance, DecreaseIssuance<AccountId, U>, IncreaseIssuance<AccountId, U>>, <U as Inspect<AccountId>>::Balance)
fn slash(
who: &AccountId,
amount: <U as Inspect<AccountId>>::Balance
) -> (Imbalance<<U as Inspect<AccountId>>::Balance, DecreaseIssuance<AccountId, U>, IncreaseIssuance<AccountId, U>>, <U as Inspect<AccountId>>::Balance)
Deducts up to value
from the combined balance of who
. This function cannot fail. Read more
fn deposit(
who: &AccountId,
amount: <U as Inspect<AccountId>>::Balance
) -> Result<Imbalance<<U as Inspect<AccountId>>::Balance, IncreaseIssuance<AccountId, U>, DecreaseIssuance<AccountId, U>>, DispatchError>
fn deposit(
who: &AccountId,
amount: <U as Inspect<AccountId>>::Balance
) -> Result<Imbalance<<U as Inspect<AccountId>>::Balance, IncreaseIssuance<AccountId, U>, DecreaseIssuance<AccountId, U>>, DispatchError>
Mints exactly value
into the account of who
. Read more
fn withdraw(
who: &AccountId,
amount: <U as Inspect<AccountId>>::Balance
) -> Result<Imbalance<<U as Inspect<AccountId>>::Balance, DecreaseIssuance<AccountId, U>, IncreaseIssuance<AccountId, U>>, DispatchError>
fn withdraw(
who: &AccountId,
amount: <U as Inspect<AccountId>>::Balance
) -> Result<Imbalance<<U as Inspect<AccountId>>::Balance, DecreaseIssuance<AccountId, U>, IncreaseIssuance<AccountId, U>>, DispatchError>
Removes value
balance from who
account if possible. Read more
fn pair(
amount: Self::Balance
) -> (Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>)
fn pair(
amount: Self::Balance
) -> (Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>, Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>)
Produce a pair of imbalances that cancel each other out exactly. Read more
fn resolve(
who: &AccountId,
credit: Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>
) -> Result<(), Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>>
fn resolve(
who: &AccountId,
credit: Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>
) -> Result<(), Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>>
The balance of who
is increased in order to counter credit
. If the whole of credit
cannot be countered, then nothing is changed and the original credit
is returned in an
Err
. Read more
fn settle(
who: &AccountId,
debt: Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>
) -> Result<Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>>
fn settle(
who: &AccountId,
debt: Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>
) -> Result<Imbalance<Self::Balance, Self::OnDropCredit, Self::OnDropDebt>, Imbalance<Self::Balance, Self::OnDropDebt, Self::OnDropCredit>>
The balance of who
is decreased in order to counter debt
. If the whole of debt
cannot be countered, then nothing is changed and the original debt
is returned in an
Err
. Read more
impl<AccountId, T> BalancedHold<AccountId> for T where
T: Balanced<AccountId> + MutateHold<AccountId>,
impl<AccountId, T> BalancedHold<AccountId> for T where
T: Balanced<AccountId> + MutateHold<AccountId>,
fn slash_held(
who: &AccountId,
amount: <T as Inspect<AccountId>>::Balance
) -> (Imbalance<<T as Inspect<AccountId>>::Balance, <T as Balanced<AccountId>>::OnDropCredit, <T as Balanced<AccountId>>::OnDropDebt>, <T as Inspect<AccountId>>::Balance)
fn slash_held(
who: &AccountId,
amount: <T as Inspect<AccountId>>::Balance
) -> (Imbalance<<T as Inspect<AccountId>>::Balance, <T as Balanced<AccountId>>::OnDropCredit, <T as Balanced<AccountId>>::OnDropDebt>, <T as Inspect<AccountId>>::Balance)
Reduce the balance of some funds on hold in an account. Read more
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> CheckedConversion for T
impl<T> CheckedConversion for T
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. 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>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
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
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
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. Read more
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. Read more
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. Read more
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. Read more
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. Read more
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. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
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,
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,
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,
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,
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,
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,
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. Read more
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,
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.
impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeDeref for T
impl<T> PipeDeref for T
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
Pipes a dereference into a function that cannot normally be called in suffix position. Read more
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more
impl<T> PipeRef for T
impl<T> PipeRef for T
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
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,
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,
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,
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,
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,
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
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
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
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. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
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. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
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. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
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. Read more
impl<T> Tap for T
impl<T> Tap for T
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Provides immutable access for inspection. Read more
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Calls tap
in debug builds, and does nothing in release builds.
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Provides mutable access for modification. Read more
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Calls tap_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the reference for inspection.
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
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) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Self where
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) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
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 T where
U: ?Sized,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Self where
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) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
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) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
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) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_borrow_mut
in debug builds, and does nothing in release
builds. Read more
impl<T> TapDeref for T
impl<T> TapDeref for T
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Immutably dereferences self
for inspection.
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
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) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Mutably dereferences self
for modification.
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Calls tap_deref_mut
in debug builds, and does nothing in release
builds. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more