Struct darwinia_staking::pallet::Pallet
source · [−]pub struct Pallet<T>(_);
Expand description
The pallet implementing the on-chain logic.
Implementations
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
pub fn account_id() -> AccountId<T>
sourcepub fn bond_ring(
stash: &AccountId<T>,
controller: &AccountId<T>,
value: RingBalance<T>,
promise_month: u8,
ledger: StakingLedgerT<T>
) -> Result<(TsInMs, TsInMs), DispatchError>
pub fn bond_ring(
stash: &AccountId<T>,
controller: &AccountId<T>,
value: RingBalance<T>,
promise_month: u8,
ledger: StakingLedgerT<T>
) -> Result<(TsInMs, TsInMs), DispatchError>
Update the ledger while bonding ring and compute the KTON reward
sourcepub fn bond_kton(
controller: &AccountId<T>,
value: KtonBalance<T>,
ledger: StakingLedgerT<T>
) -> DispatchResult
pub fn bond_kton(
controller: &AccountId<T>,
value: KtonBalance<T>,
ledger: StakingLedgerT<T>
) -> DispatchResult
Update the ledger while bonding controller with KTON
sourcepub fn clear_mature_deposits(
ledger: StakingLedgerT<T>
) -> (StakingLedgerT<T>, bool)
pub fn clear_mature_deposits(
ledger: StakingLedgerT<T>
) -> (StakingLedgerT<T>, bool)
Turn the expired deposit items into normal bond
pub fn currency_to_power<S: TryInto<Balance>>(active: S, pool: S) -> Power
sourcepub fn power_of(stash: &AccountId<T>) -> Power
pub fn power_of(stash: &AccountId<T>) -> Power
The total power that can be slashed from a stash account as of right now.
pub fn stake_of(who: &AccountId<T>) -> (RingBalance<T>, KtonBalance<T>)
pub fn weight_of_fn() -> Box<dyn Fn(&T::AccountId) -> VoteWeight>ⓘ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;
pub fn weight_of(who: &AccountId<T>) -> VoteWeight
pub fn do_payout_stakers(
validator_stash: AccountId<T>,
era: EraIndex
) -> DispatchResultWithPostInfo
sourcepub fn update_ledger(controller: &AccountId<T>, ledger: &StakingLedgerT<T>)
pub fn update_ledger(controller: &AccountId<T>, ledger: &StakingLedgerT<T>)
Update the ledger for a controller.
BE CAREFUL: This will also update the stash lock. DO NOT modify the locks’ staking amount outside this function.
sourcepub fn update_staking_pool(
active: RingBalance<T>,
origin_active: RingBalance<T>,
active_kton: KtonBalance<T>,
origin_active_kton: KtonBalance<T>
)
pub fn update_staking_pool(
active: RingBalance<T>,
origin_active: RingBalance<T>,
active_kton: KtonBalance<T>,
origin_active_kton: KtonBalance<T>
)
Update the staking pool, once any account change its bond.
sourcepub fn chill_stash(stash: &AccountId<T>)
pub fn chill_stash(stash: &AccountId<T>)
Chill a stash account.
sourcepub fn make_payout(
stash: &AccountId<T>,
amount: RingBalance<T>
) -> Option<RingPositiveImbalance<T>>
pub fn make_payout(
stash: &AccountId<T>,
amount: RingBalance<T>
) -> Option<RingPositiveImbalance<T>>
Actually make a payment to a staker. This uses the currency’s reward function to pay the right payee for the given staker account.
sourcepub fn new_session(
session_index: SessionIndex,
is_genesis: bool
) -> Option<Vec<AccountId<T>>>
pub fn new_session(
session_index: SessionIndex,
is_genesis: bool
) -> Option<Vec<AccountId<T>>>
Plan a new session potentially trigger a new era.
sourcepub fn start_session(start_session: SessionIndex)
pub fn start_session(start_session: SessionIndex)
Start a session potentially starting an era.
sourcepub fn end_session(session_index: SessionIndex)
pub fn end_session(session_index: SessionIndex)
End a session potentially ending an era.
sourcepub fn start_era(start_session: SessionIndex)
pub fn start_era(start_session: SessionIndex)
- Increment
active_era.index
, - reset
active_era.start
, - update
BondedEras
and apply slashes.
sourcepub fn end_era(active_era: ActiveEraInfo, _session_index: SessionIndex)
pub fn end_era(active_era: ActiveEraInfo, _session_index: SessionIndex)
Compute payout for era.
sourcepub fn trigger_new_era(
start_session_index: SessionIndex,
exposures: Vec<(AccountId<T>, ExposureT<T>)>
) -> Vec<AccountId<T>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn trigger_new_era(
start_session_index: SessionIndex,
exposures: Vec<(AccountId<T>, ExposureT<T>)>
) -> Vec<AccountId<T>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Plan a new era.
- Bump the current era storage (which holds the latest planned era).
- Store start session index for the new planned era.
- Clean old era information.
- Store staking information for the new planned era
Returns the new validator set.
sourcepub fn store_stakers_info(
exposures: Vec<(AccountId<T>, ExposureT<T>)>,
new_planned_era: EraIndex
) -> Vec<AccountId<T>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn store_stakers_info(
exposures: Vec<(AccountId<T>, ExposureT<T>)>,
new_planned_era: EraIndex
) -> Vec<AccountId<T>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Process the output of the election.
Store staking information for the new planned era
sourcepub fn collect_exposures(
supports: Supports<AccountId<T>>
) -> Vec<(AccountId<T>, ExposureT<T>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn collect_exposures(
supports: Supports<AccountId<T>>
) -> Vec<(AccountId<T>, ExposureT<T>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Consume a set of [Supports
] from [sp_npos_elections
] and collect them into a
Exposure
.
sourcepub fn kill_stash(
stash: &AccountId<T>,
num_slashing_spans: u32
) -> DispatchResult
pub fn kill_stash(
stash: &AccountId<T>,
num_slashing_spans: u32
) -> DispatchResult
Remove all associated data of a stash account from the staking system.
Assumes storage is upgraded before calling.
This is called:
- after a
withdraw_unbond()
call that frees all of a stash’s bonded balance. - through
reap_stash()
if the balance has fallen to zero (through slashing).
sourcepub fn clear_era_information(era_index: EraIndex)
pub fn clear_era_information(era_index: EraIndex)
Clear all era information for given era.
sourcepub fn apply_unapplied_slashes(active_era: EraIndex)
pub fn apply_unapplied_slashes(active_era: EraIndex)
Apply previously-unapplied slashes on the beginning of a new era, after a delay.
sourcepub fn reward_by_ids(
validators_points: impl IntoIterator<Item = (AccountId<T>, u32)>
)
pub fn reward_by_ids(
validators_points: impl IntoIterator<Item = (AccountId<T>, u32)>
)
Add reward points to validators using their stash account ID.
Validators are keyed by stash account ID and must be in the current elected set.
For each element in the iterator the given number of points in u32 is added to the validator, thus duplicates are handled.
At the end of the era each the total payout will be distributed among validator relatively to their points.
COMPLEXITY: Complexity is number_of_validator_to_reward x current_elected_len
.
If you need to reward lots of validator consider using reward_by_indices
.
sourcepub fn ensure_new_era()
pub fn ensure_new_era()
Ensures that at the end of the current session there will be a new era.
sourcepub fn get_npos_voters(
maybe_max_len: Option<usize>
) -> Vec<(AccountId<T>, VoteWeight, Vec<AccountId<T>>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_npos_voters(
maybe_max_len: Option<usize>
) -> Vec<(AccountId<T>, VoteWeight, Vec<AccountId<T>>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get all of the voters that are eligible for the npos election.
maybe_max_len
can imposes a cap on the number of voters returned; First all the validator
are included in no particular order, then remainder is taken from the nominators, as
returned by Config::SortedListProvider
.
This will use nominators, and all the validators will inject a self vote.
This function is self-weighing as [DispatchClass::Mandatory
].
Slashing
All nominations that have been submitted before the last non-zero slash of the validator are
auto-chilled, but still count towards the limit imposed by maybe_max_len
.
sourcepub fn get_npos_targets() -> Vec<AccountId<T>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn get_npos_targets() -> Vec<AccountId<T>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get the targets for an upcoming npos election.
This function is self-weighing as [DispatchClass::Mandatory
].
sourcepub fn do_add_nominator(
who: &T::AccountId,
nominations: Nominations<T::AccountId>
)
pub fn do_add_nominator(
who: &T::AccountId,
nominations: Nominations<T::AccountId>
)
This function will add a nominator to the Nominators
storage map,
and [SortedListProvider
].
If the nominator already exists, their nominations will be updated.
NOTE: you must ALWAYS use this function to add nominator or update their targets. Any access
to Nominators
or VoterList
outside of this function is almost certainly
wrong.
sourcepub fn do_remove_nominator(who: &T::AccountId) -> bool
pub fn do_remove_nominator(who: &T::AccountId) -> bool
This function will remove a nominator from the Nominators
storage map,
and [SortedListProvider
].
Returns true if who
was removed from Nominators
, otherwise false.
NOTE: you must ALWAYS use this function to remove a nominator from the system. Any access to
Nominators
or VoterList
outside of this function is almost certainly
wrong.
sourcepub fn do_add_validator(who: &T::AccountId, prefs: ValidatorPrefs)
pub fn do_add_validator(who: &T::AccountId, prefs: ValidatorPrefs)
This function will add a validator to the Validators
storage map.
If the validator already exists, their preferences will be updated.
NOTE: you must ALWAYS use this function to add a validator to the system. Any access to
Validators
or VoterList
outside of this function is almost certainly
wrong.
sourcepub fn do_remove_validator(who: &T::AccountId) -> bool
pub fn do_remove_validator(who: &T::AccountId) -> bool
This function will remove a validator from the Validators
storage map.
Returns true if who
was removed from Validators
, otherwise false.
NOTE: you must ALWAYS use this function to remove a validator from the system. Any access to
Validators
or VoterList
outside of this function is almost certainly
wrong.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn bond(
origin: OriginFor<T>,
controller: <T::Lookup as StaticLookup>::Source,
value: StakingBalanceT<T>,
payee: RewardDestination<AccountId<T>>,
promise_month: u8
) -> DispatchResult
pub fn bond(
origin: OriginFor<T>,
controller: <T::Lookup as StaticLookup>::Source,
value: StakingBalanceT<T>,
payee: RewardDestination<AccountId<T>>,
promise_month: u8
) -> DispatchResult
Take the origin account as a stash and lock up value
of its balance. controller
will
be the account that controls it.
value
must be more than the minimum_balance
specified by T::Currency
.
The dispatch origin for this call must be Signed by the stash account.
Emits Bonded
.
- Independent of the arguments. Moderate complexity.
- O(1).
- Three extra DB entries.
NOTE: Two of the storage writes (Self::bonded
, Self::payee
) are never cleaned
unless the origin
falls below existential deposit and gets removed as dust.
sourcepub fn bond_extra(
origin: OriginFor<T>,
max_additional: StakingBalanceT<T>,
promise_month: u8
) -> DispatchResult
pub fn bond_extra(
origin: OriginFor<T>,
max_additional: StakingBalanceT<T>,
promise_month: u8
) -> DispatchResult
Add some extra amount that have appeared in the stash free_balance
into the balance up
for staking.
The dispatch origin for this call must be Signed by the stash, not the controller.
Use this if there are additional funds in your stash account that you wish to bond.
Unlike bond
or unbond
this function does not impose
any limitation on the amount that can be added.
Emits Bonded
.
- Independent of the arguments. Insignificant complexity.
- O(1).
sourcepub fn deposit_extra(
origin: OriginFor<T>,
value: RingBalance<T>,
promise_month: u8
) -> DispatchResult
pub fn deposit_extra(
origin: OriginFor<T>,
value: RingBalance<T>,
promise_month: u8
) -> DispatchResult
Deposit some extra amount ring, and return kton to the controller.
The dispatch origin for this call must be Signed by the stash, not the controller.
Is a no-op if value to be deposited is zero.
- Independent of the arguments. Insignificant complexity.
- O(1).
- One DB entry.
DB Weight:
- Read: Era Election Status, Bonded, Ledger, [Origin Account]
- Write: [Origin Account], Ledger
sourcepub fn unbond(origin: OriginFor<T>, value: StakingBalanceT<T>) -> DispatchResult
pub fn unbond(origin: OriginFor<T>, value: StakingBalanceT<T>) -> DispatchResult
Schedule a portion of the stash to be unlocked ready for transfer out after the bond period ends. If this leaves an amount actively bonded less than T::Currency::minimum_balance(), then it is increased to the full amount.
The dispatch origin for this call must be Signed by the controller, not the stash.
Once the unlock period is done, the funds will be withdrew automatically and ready for transfer.
No more than a limited number of unlocking chunks (see MAX_UNLOCKING_CHUNKS
)
can co-exists at the same time. In that case, [StakingLock::shrink
] need
to be called first to remove some of the chunks (if possible).
If a user encounters the InsufficientBond
error when calling this extrinsic,
they should call chill
first in order to free up their bonded funds.
After all pledged Ring and Kton are unbonded, the bonded accounts, namely stash and
controller, will also be unbonded. Once user want to bond again, the bond
method
should be called. If there are still pledged Ring or Kton and user want to bond more
values, the bond_extra
method should be called.
sourcepub fn withdraw_unbonded(
origin: OriginFor<T>,
num_slashing_spans: u32
) -> DispatchResultWithPostInfo
pub fn withdraw_unbonded(
origin: OriginFor<T>,
num_slashing_spans: u32
) -> DispatchResultWithPostInfo
Remove any unlocked chunks from the unlocking
queue from our management.
This essentially frees up that balance to be used by the stash account to do whatever it wants.
The dispatch origin for this call must be Signed by the controller.
Emits Withdrawn
.
See also Call::unbond
.
Complexity O(S) where S is the number of slashing spans to remove NOTE: Weight annotation is the kill scenario, we refund otherwise.
sourcepub fn claim_mature_deposits(origin: OriginFor<T>) -> DispatchResult
pub fn claim_mature_deposits(origin: OriginFor<T>) -> DispatchResult
Stash accounts can get their ring back after the depositing time exceeded, and the ring getting back is still in staking status.
- Independent of the arguments. Insignificant complexity.
- One storage read.
- One storage write.
- Writes are limited to the
origin
account key.
DB Weight:
- Read: Ledger, [Origin Account]
- Write: [Origin Account], Ledger
sourcepub fn try_claim_deposits_with_punish(
origin: OriginFor<T>,
expire_time: TsInMs
) -> DispatchResult
pub fn try_claim_deposits_with_punish(
origin: OriginFor<T>,
expire_time: TsInMs
) -> DispatchResult
Claim deposits while the depositing time has not been exceeded, the ring will not be slashed, but the account is required to pay KTON as punish.
Refer to https://talk.darwinia.network/topics/55
Assume the expire_time
is a unique ID for the deposit
- Independent of the arguments. Insignificant complexity.
- One storage read.
- One storage write.
- Writes are limited to the
origin
account key.
DB Weight:
- Read: Ledger, Locks, [Origin Account]
- Write: [Origin Account], Locks, Ledger
sourcepub fn validate(origin: OriginFor<T>, prefs: ValidatorPrefs) -> DispatchResult
pub fn validate(origin: OriginFor<T>, prefs: ValidatorPrefs) -> DispatchResult
Declare the desire to validate for the origin controller.
Effects will be felt at the beginning of the next era.
The dispatch origin for this call must be Signed by the controller, not the stash.
sourcepub fn nominate(
origin: OriginFor<T>,
targets: Vec<<T::Lookup as StaticLookup>::Source>
) -> DispatchResult
pub fn nominate(
origin: OriginFor<T>,
targets: Vec<<T::Lookup as StaticLookup>::Source>
) -> DispatchResult
Declare the desire to nominate targets
for the origin controller.
Effects will be felt at the beginning of the next era.
The dispatch origin for this call must be Signed by the controller, not the stash.
- The transaction’s complexity is proportional to the size of
targets
(N) which is capped at CompactAssignments::LIMIT (MAX_NOMINATIONS). - Both the reads and writes follow a similar pattern.
sourcepub fn chill(origin: OriginFor<T>) -> DispatchResult
pub fn chill(origin: OriginFor<T>) -> DispatchResult
Declare no desire to either validate or nominate.
Effects will be felt at the beginning of the next era.
The dispatch origin for this call must be Signed by the controller, not the stash.
- Independent of the arguments. Insignificant complexity.
- Contains one read.
- Writes are limited to the
origin
account key.
sourcepub fn set_payee(
origin: OriginFor<T>,
payee: RewardDestination<AccountId<T>>
) -> DispatchResult
pub fn set_payee(
origin: OriginFor<T>,
payee: RewardDestination<AccountId<T>>
) -> DispatchResult
(Re-)set the payment target for a controller.
Effects will be felt at the beginning of the next era.
The dispatch origin for this call must be Signed by the controller, not the stash.
- Independent of the arguments. Insignificant complexity.
- Contains a limited number of reads.
- Writes are limited to the
origin
account key.
- Weight: O(1)
- DB Weight:
- Read: Ledger
- Write: Payee
sourcepub fn set_controller(
origin: OriginFor<T>,
controller: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn set_controller(
origin: OriginFor<T>,
controller: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
(Re-)set the controller of a stash.
Effects will be felt at the beginning of the next era.
The dispatch origin for this call must be Signed by the stash, not the controller.
- Independent of the arguments. Insignificant complexity.
- Contains a limited number of reads.
- Writes are limited to the
origin
account key.
Weight: O(1) DB Weight:
- Read: Bonded, Ledger New Controller, Ledger Old Controller
- Write: Bonded, Ledger New Controller, Ledger Old Controller
sourcepub fn set_validator_count(origin: OriginFor<T>, new: u32) -> DispatchResult
pub fn set_validator_count(origin: OriginFor<T>, new: u32) -> DispatchResult
sourcepub fn increase_validator_count(
origin: OriginFor<T>,
additional: u32
) -> DispatchResult
pub fn increase_validator_count(
origin: OriginFor<T>,
additional: u32
) -> DispatchResult
Increments the ideal number of validators.
The dispatch origin must be Root.
Same as Self::set_validator_count
.
sourcepub fn scale_validator_count(
origin: OriginFor<T>,
factor: Percent
) -> DispatchResult
pub fn scale_validator_count(
origin: OriginFor<T>,
factor: Percent
) -> DispatchResult
Scale up the ideal number of validators by a factor.
The dispatch origin must be Root.
Same as Self::set_validator_count
.
sourcepub fn force_no_eras(origin: OriginFor<T>) -> DispatchResult
pub fn force_no_eras(origin: OriginFor<T>) -> DispatchResult
Force there to be no new eras indefinitely.
The dispatch origin must be Root.
Warning
The election process starts multiple blocks before the end of the era. Thus the election process may be ongoing when this is called. In this case the election will continue until the next era is triggered.
- No arguments.
- Weight: O(1)
- Write: ForceEra
sourcepub fn force_new_era(origin: OriginFor<T>) -> DispatchResult
pub fn force_new_era(origin: OriginFor<T>) -> DispatchResult
Force there to be a new era at the end of the next session. After this, it will be reset to normal (non-forced) behaviour.
The dispatch origin must be Root.
Warning
The election process starts multiple blocks before the end of the era. If this is called just before a new era is triggered, the election process may not have enough blocks to get a result.
- No arguments.
- Weight: O(1)
- Write ForceEra
sourcepub fn set_invulnerables(
origin: OriginFor<T>,
invulnerables: Vec<AccountId<T>>
) -> DispatchResult
pub fn set_invulnerables(
origin: OriginFor<T>,
invulnerables: Vec<AccountId<T>>
) -> DispatchResult
sourcepub fn force_unstake(
origin: OriginFor<T>,
stash: AccountId<T>,
num_slashing_spans: u32
) -> DispatchResult
pub fn force_unstake(
origin: OriginFor<T>,
stash: AccountId<T>,
num_slashing_spans: u32
) -> DispatchResult
Force a current staker to become completely unstaked, immediately.
The dispatch origin must be Root.
O(S) where S is the number of slashing spans to be removed Reads: Bonded, Slashing Spans, Account, Locks Writes: Bonded, Slashing Spans (if S > 0), Ledger, Payee, Validators, Nominators, Account, Locks Writes Each: SpanSlash * S
sourcepub fn force_new_era_always(origin: OriginFor<T>) -> DispatchResult
pub fn force_new_era_always(origin: OriginFor<T>) -> DispatchResult
Force there to be a new era at the end of sessions indefinitely.
The dispatch origin must be Root.
Warning
The election process starts multiple blocks before the end of the era. If this is called just before a new era is triggered, the election process may not have enough blocks to get a result.
- Weight: O(1)
- Write: ForceEra
sourcepub fn cancel_deferred_slash(
origin: OriginFor<T>,
era: EraIndex,
slash_indices: Vec<u32>
) -> DispatchResult
pub fn cancel_deferred_slash(
origin: OriginFor<T>,
era: EraIndex,
slash_indices: Vec<u32>
) -> DispatchResult
Cancel enactment of a deferred slash.
Can be called by the T::SlashCancelOrigin
.
Parameters: era and indices of the slashes for that era to kill.
Complexity: O(U + S) with U unapplied slashes weighted with U=1000 and S is the number of slash indices to be canceled.
- Read: Unapplied Slashes
- Write: Unapplied Slashes
sourcepub fn payout_stakers(
origin: OriginFor<T>,
validator_stash: AccountId<T>,
era: EraIndex
) -> DispatchResultWithPostInfo
pub fn payout_stakers(
origin: OriginFor<T>,
validator_stash: AccountId<T>,
era: EraIndex
) -> DispatchResultWithPostInfo
Pay out all the stakers behind a single validator for a single era.
validator_stash
is the stash account of the validator. Their nominators, up toT::MaxNominatorRewardedPerValidator
, will also receive their rewards.era
may be any era between[current_era - history_depth; current_era]
.
The origin of this call must be Signed. Any account can call this function, even if it is not one of the stakers.
- Time complexity: at most O(MaxNominatorRewardedPerValidator).
- Contains a limited number of reads and writes.
N is the Number of payouts for the validator (including the validator) Weight:
-
Reward Destination Staked: O(N)
-
Reward Destination Controller (Creating): O(N)
NOTE: weights are assuming that payouts are made to alive stash account (Staked). Paying even a dead controller is cheaper weight-wise. We don’t do any refunds here.
sourcepub fn rebond(
origin: OriginFor<T>,
plan_to_rebond_ring: RingBalance<T>,
plan_to_rebond_kton: KtonBalance<T>
) -> DispatchResultWithPostInfo
pub fn rebond(
origin: OriginFor<T>,
plan_to_rebond_ring: RingBalance<T>,
plan_to_rebond_kton: KtonBalance<T>
) -> DispatchResultWithPostInfo
sourcepub fn set_history_depth(
origin: OriginFor<T>,
new_history_depth: EraIndex,
_era_items_deleted: u32
) -> DispatchResult
pub fn set_history_depth(
origin: OriginFor<T>,
new_history_depth: EraIndex,
_era_items_deleted: u32
) -> DispatchResult
Set HistoryDepth
value. This function will delete any history information
when HistoryDepth
is reduced.
Parameters:
new_history_depth
: The new history depth you would like to set.era_items_deleted
: The number of items that will be deleted by this dispatch. This should report all the storage items that will be deleted by clearing old era history. Needed to report an accurate weight for the dispatch. Trusted byRoot
to report an accurate number.
Origin must be root.
- E: Number of history depths removed, i.e. 10 -> 7 = 3
- Weight: O(E)
- DB Weight:
- Reads: Current Era, History Depth
- Writes: History Depth
- Clear Prefix Each: Era Stakers, EraStakersClipped, ErasValidatorPrefs
- Writes Each: ErasValidatorReward, ErasRewardPoints, ErasTotalStake, ErasStartSessionIndex
sourcepub fn reap_stash(
origin: OriginFor<T>,
stash: AccountId<T>,
num_slashing_spans: u32
) -> DispatchResultWithPostInfo
pub fn reap_stash(
origin: OriginFor<T>,
stash: AccountId<T>,
num_slashing_spans: u32
) -> DispatchResultWithPostInfo
Remove all data structures concerning a staker/stash once it is at a state where it can
be considered dust
in the staking system. The requirements are:
- the
total_balance
of the stash is below existential deposit. - or, the
ledger.total
of the stash is below existential deposit.
The former can happen in cases like a slash; the latter when a fully unbonded account
is still receiving staking rewards in RewardDestination::Staked
.
It can be called by anyone, as long as stash
meets the above requirements.
Refunds the transaction fees upon successful execution.
sourcepub fn kick(
origin: OriginFor<T>,
who: Vec<<T::Lookup as StaticLookup>::Source>
) -> DispatchResult
pub fn kick(
origin: OriginFor<T>,
who: Vec<<T::Lookup as StaticLookup>::Source>
) -> DispatchResult
Remove the given nominations from the calling validator.
Effects will be felt at the beginning of the next era.
The dispatch origin for this call must be Signed by the controller, not the stash.
who
: A list of nominator stash accounts who are nominating this validator which should no longer be nominating this validator.
Note: Making this call only makes sense if you first set the validator preferences to block any further nominations.
sourcepub fn set_staking_configs(
origin: OriginFor<T>,
min_nominator_bond: RingBalance<T>,
min_validator_bond: RingBalance<T>,
max_nominator_count: Option<u32>,
max_validator_count: Option<u32>,
chill_threshold: Option<Percent>,
min_commission: Perbill
) -> DispatchResult
pub fn set_staking_configs(
origin: OriginFor<T>,
min_nominator_bond: RingBalance<T>,
min_validator_bond: RingBalance<T>,
max_nominator_count: Option<u32>,
max_validator_count: Option<u32>,
chill_threshold: Option<Percent>,
min_commission: Perbill
) -> DispatchResult
Update the various staking configurations.
min_nominator_bond
: The minimum active bond needed to be a nominator.min_validator_bond
: The minimum active bond needed to be a validator.max_nominator_count
: The max number of users who can be a nominator at once. When set toNone
, no limit is enforced.max_validator_count
: The max number of users who can be a validator at once. When set toNone
, no limit is enforced.chill_threshold
: The ratio ofmax_nominator_count
ormax_validator_count
which should be filled in order for thechill_other
transaction to work.min_commission
: The minimum amount of commission that each validators must maintain. This is checked only upon callingvalidate
. Existing validators are not affected.
Origin must be Root to call this function.
NOTE: Existing nominators and validators will not be affected by this update.
to kick people under the new limits, chill_other
should be called.
sourcepub fn chill_other(
origin: OriginFor<T>,
controller: T::AccountId
) -> DispatchResult
pub fn chill_other(
origin: OriginFor<T>,
controller: T::AccountId
) -> DispatchResult
Declare a controller
to stop participating as either a validator or nominator.
Effects will be felt at the beginning of the next era.
The dispatch origin for this call must be Signed, but can be called by anyone.
If the caller is the same as the controller being targeted, then no further checks are
enforced, and this function behaves just like chill
.
If the caller is different than the controller being targeted, the following conditions must be met:
- A
ChillThreshold
must be set and checked which defines how close to the max nominators or validators we must reach before users can start chilling one-another. - A
MaxNominatorCount
andMaxValidatorCount
must be set which is used to determine how close we are to the threshold. - A
MinNominatorBond
andMinValidatorBond
must be set and checked, which determines if this is a person that should be chilled because they have not met the threshold bond required.
This can be helpful if bond requirements are updated, and we need to remove old users who do not satisfy these requirements.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn history_depth() -> u32
pub fn history_depth() -> u32
Number of eras to keep in history.
Information is kept for eras in [current_era - history_depth; current_era]
.
Must be more than the number of eras delayed by session otherwise. I.e. active era must
always be in history. I.e. active_era > current_era - history_depth
must be
guaranteed.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn validator_count() -> u32
pub fn validator_count() -> u32
The ideal number of staking participants.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn minimum_validator_count() -> u32
pub fn minimum_validator_count() -> u32
Minimum number of staking participants before emergency conditions are imposed.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn invulnerables() -> Vec<AccountId<T>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn invulnerables() -> Vec<AccountId<T>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Any validators that may never be slashed or forcibly kicked. It’s a Vec since they’re easy to initialize and the performance hit is minimal (we expect no more than four invulnerables) and restricted to testnets.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn ledger<KArg>(k: KArg) -> Option<StakingLedgerT<T>> where
KArg: EncodeLike<AccountId<T>>,
pub fn ledger<KArg>(k: KArg) -> Option<StakingLedgerT<T>> where
KArg: EncodeLike<AccountId<T>>,
Map from all (unlocked) “controller” accounts to the info regarding the staking.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn payee<KArg>(k: KArg) -> RewardDestination<AccountId<T>> where
KArg: EncodeLike<AccountId<T>>,
pub fn payee<KArg>(k: KArg) -> RewardDestination<AccountId<T>> where
KArg: EncodeLike<AccountId<T>>,
Where the reward payment should be made. Keyed by stash.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn validators<KArg>(k: KArg) -> ValidatorPrefs where
KArg: EncodeLike<AccountId<T>>,
pub fn validators<KArg>(k: KArg) -> ValidatorPrefs where
KArg: EncodeLike<AccountId<T>>,
The map from (wannabe) validator stash key to the preferences of that validator.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn nominators<KArg>(k: KArg) -> Option<Nominations<AccountId<T>>> where
KArg: EncodeLike<AccountId<T>>,
pub fn nominators<KArg>(k: KArg) -> Option<Nominations<AccountId<T>>> where
KArg: EncodeLike<AccountId<T>>,
The map from nominator stash key to the set of stash keys of all validators to nominate.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn current_era() -> Option<EraIndex>
pub fn current_era() -> Option<EraIndex>
The current era index.
This is the latest planned era, depending on how the Session pallet queues the validator set, it might be active or not.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn active_era() -> Option<ActiveEraInfo>
pub fn active_era() -> Option<ActiveEraInfo>
The active era information, it holds index and start.
The active era is the era being currently rewarded. Validator set of this era must be
equal to SessionInterface::validators
.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn eras_start_session_index<KArg>(k: KArg) -> Option<SessionIndex> where
KArg: EncodeLike<EraIndex>,
pub fn eras_start_session_index<KArg>(k: KArg) -> Option<SessionIndex> where
KArg: EncodeLike<EraIndex>,
The session index at which the era start for the last HISTORY_DEPTH
eras.
Note: This tracks the starting session (i.e. session index when era start being active)
for the eras in [CurrentEra - HISTORY_DEPTH, CurrentEra]
.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn eras_stakers<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> ExposureT<T> where
KArg1: EncodeLike<EraIndex>,
KArg2: EncodeLike<AccountId<T>>,
pub fn eras_stakers<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> ExposureT<T> where
KArg1: EncodeLike<EraIndex>,
KArg2: EncodeLike<AccountId<T>>,
Exposure of validator at era.
This is keyed first by the era index to allow bulk deletion and then the stash account.
Is it removed after HISTORY_DEPTH
eras.
If stakers hasn’t been set or has been removed then empty exposure is returned.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn eras_stakers_clipped<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> ExposureT<T> where
KArg1: EncodeLike<EraIndex>,
KArg2: EncodeLike<AccountId<T>>,
pub fn eras_stakers_clipped<KArg1, KArg2>(k1: KArg1, k2: KArg2) -> ExposureT<T> where
KArg1: EncodeLike<EraIndex>,
KArg2: EncodeLike<AccountId<T>>,
Clipped Exposure of validator at era.
This is similar to ErasStakers
but number of nominators exposed is reduced to the
T::MaxNominatorRewardedPerValidator
biggest stakers.
(Note: the field total
and own
of the exposure remains unchanged).
This is used to limit the i/o cost for the nominator payout.
This is keyed fist by the era index to allow bulk deletion and then the stash account.
Is it removed after HISTORY_DEPTH
eras.
If stakers hasn’t been set or has been removed then empty exposure is returned.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn eras_validator_prefs<KArg1, KArg2>(
k1: KArg1,
k2: KArg2
) -> ValidatorPrefs where
KArg1: EncodeLike<EraIndex>,
KArg2: EncodeLike<AccountId<T>>,
pub fn eras_validator_prefs<KArg1, KArg2>(
k1: KArg1,
k2: KArg2
) -> ValidatorPrefs where
KArg1: EncodeLike<EraIndex>,
KArg2: EncodeLike<AccountId<T>>,
Similar to ErasStakers
, this holds the preferences of validators.
This is keyed first by the era index to allow bulk deletion and then the stash account.
Is it removed after HISTORY_DEPTH
eras.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn eras_validator_reward<KArg>(k: KArg) -> Option<RingBalance<T>> where
KArg: EncodeLike<EraIndex>,
pub fn eras_validator_reward<KArg>(k: KArg) -> Option<RingBalance<T>> where
KArg: EncodeLike<EraIndex>,
The total validator era payout for the last HISTORY_DEPTH
eras.
Eras that haven’t finished yet or has been removed doesn’t have reward.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn eras_reward_points<KArg>(k: KArg) -> EraRewardPoints<AccountId<T>> where
KArg: EncodeLike<EraIndex>,
pub fn eras_reward_points<KArg>(k: KArg) -> EraRewardPoints<AccountId<T>> where
KArg: EncodeLike<EraIndex>,
Rewards for the last HISTORY_DEPTH
eras.
If reward hasn’t been set or has been removed then 0 reward is returned.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn eras_total_stake<KArg>(k: KArg) -> Power where
KArg: EncodeLike<EraIndex>,
pub fn eras_total_stake<KArg>(k: KArg) -> Power where
KArg: EncodeLike<EraIndex>,
The total amount staked for the last HISTORY_DEPTH
eras.
If total hasn’t been set or has been removed then 0 stake is returned.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn slash_reward_fraction() -> Perbill
pub fn slash_reward_fraction() -> Perbill
The percentage of the slash that is distributed to reporters.
The rest of the slashed value is handled by the Slash
.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn canceled_payout() -> Power
pub fn canceled_payout() -> Power
The amount of currency given to reporters of a slash event which was canceled by extraordinary circumstances (e.g. governance).
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn current_planned_session() -> SessionIndex
pub fn current_planned_session() -> SessionIndex
The last planned session scheduled by the session pallet.
This is basically in sync with the call to [pallet_session::SessionManager::new_session
].
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn offending_validators() -> Vec<(u32, bool)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn offending_validators() -> Vec<(u32, bool)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Indices of validators that have offended in the active era and whether they are currently disabled.
This value should be a superset of disabled validators since not all offences lead to the
validator being disabled (if there was no slash). This is needed to track the percentage of
validators that have offended in the current era, ensuring a new era is forced if
OffendingValidatorsThreshold
is reached. The vec is always kept sorted so that we can find
whether a given validator has previously offended using binary search. It gets cleared when
the era ends.
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn living_time() -> TsInMs
pub fn living_time() -> TsInMs
The chain’s running time form genesis in milliseconds, use for calculate darwinia era payout
sourceimpl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn payout_fraction() -> Perbill
pub fn payout_fraction() -> Perbill
The percentage of the total payout that is distributed to validators and nominators
The reset might go to Treasury or something else.
Trait Implementations
sourceimpl<T: Config> ElectionDataProvider for Pallet<T>
impl<T: Config> ElectionDataProvider for Pallet<T>
type AccountId = <T as Config>::AccountId
type AccountId = <T as Config>::AccountId
The account identifier type.
type BlockNumber = <T as Config>::BlockNumber
type BlockNumber = <T as Config>::BlockNumber
The block number type.
sourceconst MAXIMUM_VOTES_PER_VOTER: u32 = T::MAX_NOMINATIONS
const MAXIMUM_VOTES_PER_VOTER: u32 = T::MAX_NOMINATIONS
Maximum number of votes per voter that this data provider is providing.
sourcefn desired_targets() -> Result<u32>
fn desired_targets() -> Result<u32>
The number of targets to elect. Read more
sourcefn voters(
maybe_max_len: Option<usize>
) -> Result<Vec<(AccountId<T>, VoteWeight, Vec<AccountId<T>>)>>
fn voters(
maybe_max_len: Option<usize>
) -> Result<Vec<(AccountId<T>, VoteWeight, Vec<AccountId<T>>)>>
All possible voters for the election. Read more
sourcefn targets(maybe_max_len: Option<usize>) -> Result<Vec<T::AccountId>>
fn targets(maybe_max_len: Option<usize>) -> Result<Vec<T::AccountId>>
All possible targets for the election, i.e. the candidates. Read more
sourcefn next_election_prediction(now: BlockNumberFor<T>) -> BlockNumberFor<T>
fn next_election_prediction(now: BlockNumberFor<T>) -> BlockNumberFor<T>
Provide a best effort prediction about when the next election is about to happen. Read more
sourceimpl<T> EventHandler<<T as Config>::AccountId, <T as Config>::BlockNumber> for Pallet<T> where
T: Config + Config + Config,
impl<T> EventHandler<<T as Config>::AccountId, <T as Config>::BlockNumber> for Pallet<T> where
T: Config + Config + Config,
Add reward points to block authors:
- 20 points to the block producer for producing a (non-uncle) block in the relay chain,
- 2 points to the block producer for each reference to a previously unreferenced uncle, and
- 1 point to the producer of each referenced uncle block.
Note that the given account ID is the author of the current block.
sourcefn note_uncle(uncle_author: T::AccountId, _age: T::BlockNumber)
fn note_uncle(uncle_author: T::AccountId, _age: T::BlockNumber)
Note that the given account ID authored the given uncle, and how many blocks older than the current block it is (age >= 0, so siblings are allowed) Read more
sourceimpl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
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> Hooks<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>
sourcefn on_initialize(_now: T::BlockNumber) -> Weight
fn on_initialize(_now: T::BlockNumber) -> Weight
The block is being initialized. Implement to have something happen. Read more
sourcefn on_finalize(_n: BlockNumberFor<T>)
fn on_finalize(_n: BlockNumberFor<T>)
The block is being finalized. Implement to have something happen.
sourcefn integrity_test()
fn integrity_test()
Run integrity test. Read more
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_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
sourceimpl<T: Config> IntegrityTest for Pallet<T>
impl<T: Config> IntegrityTest for Pallet<T>
sourcefn integrity_test()
fn integrity_test()
Run integrity test. Read more
sourceimpl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>
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> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>
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> OnGenesis for Pallet<T>
impl<T: Config> OnGenesis for Pallet<T>
sourcefn on_genesis()
fn on_genesis()
Something that should happen at genesis.
sourceimpl<T: Config> OnIdle<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OnIdle<<T as Config>::BlockNumber> for Pallet<T>
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> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>
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> OnOffenceHandler<<T as Config>::AccountId, (<T as Config>::ValidatorId, <T as Config>::FullIdentification), u64> for Pallet<T> where
T: Config + Config<ValidatorId = AccountId<T>> + Config<FullIdentification = ExposureT<T>, FullIdentificationOf = ExposureOf<T>>,
T::SessionHandler: SessionHandler<AccountId<T>>,
T::SessionManager: SessionManager<AccountId<T>>,
T::ValidatorIdOf: Convert<AccountId<T>, Option<AccountId<T>>>,
impl<T> OnOffenceHandler<<T as Config>::AccountId, (<T as Config>::ValidatorId, <T as Config>::FullIdentification), u64> for Pallet<T> where
T: Config + Config<ValidatorId = AccountId<T>> + Config<FullIdentification = ExposureT<T>, FullIdentificationOf = ExposureOf<T>>,
T::SessionHandler: SessionHandler<AccountId<T>>,
T::SessionManager: SessionManager<AccountId<T>>,
T::ValidatorIdOf: Convert<AccountId<T>, Option<AccountId<T>>>,
This is intended to be used with FilterHistoricalOffences
.
sourceimpl<T: Config> OnRuntimeUpgrade for Pallet<T>
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
sourcefn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Perform a module upgrade. Read more
sourceimpl<T: Config> PalletInfoAccess for Pallet<T>
impl<T: Config> PalletInfoAccess for Pallet<T>
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> PalletsInfoAccess for Pallet<T>
impl<T: Config> PalletsInfoAccess for Pallet<T>
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> SessionManager<<T as Config>::AccountId, Exposure<<T as Config>::AccountId, <<T as Config>::RingCurrency as Currency<<T as Config>::AccountId>>::Balance, <<T as Config>::KtonCurrency as Currency<<T as Config>::AccountId>>::Balance>> for Pallet<T>
impl<T: Config> SessionManager<<T as Config>::AccountId, Exposure<<T as Config>::AccountId, <<T as Config>::RingCurrency as Currency<<T as Config>::AccountId>>::Balance, <<T as Config>::KtonCurrency as Currency<<T as Config>::AccountId>>::Balance>> for Pallet<T>
sourcefn new_session(
new_index: SessionIndex
) -> Option<Vec<(AccountId<T>, ExposureT<T>)>>
fn new_session(
new_index: SessionIndex
) -> Option<Vec<(AccountId<T>, ExposureT<T>)>>
If there was a validator set change, its returns the set of new validators along with their full identifications. Read more
fn new_session_genesis(
new_index: SessionIndex
) -> Option<Vec<(AccountId<T>, ExposureT<T>)>>
fn start_session(start_index: SessionIndex)
fn end_session(end_index: SessionIndex)
sourceimpl<T: Config> SessionManager<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> SessionManager<<T as Config>::AccountId> for Pallet<T>
sourcefn new_session(new_index: SessionIndex) -> Option<Vec<AccountId<T>>>
fn new_session(new_index: SessionIndex) -> Option<Vec<AccountId<T>>>
Plan a new session, and optionally provide the new validator set. Read more
sourcefn new_session_genesis(new_index: SessionIndex) -> Option<Vec<AccountId<T>>>
fn new_session_genesis(new_index: SessionIndex) -> Option<Vec<AccountId<T>>>
Same as new_session
, but it this should only be called at genesis. Read more
sourcefn start_session(start_index: SessionIndex)
fn start_session(start_index: SessionIndex)
Start an already planned session. Read more
sourcefn end_session(end_index: SessionIndex)
fn end_session(end_index: SessionIndex)
End the session. Read more
sourceimpl<T: Config> VoteWeightProvider<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> VoteWeightProvider<<T as Config>::AccountId> for Pallet<T>
sourcefn vote_weight(who: &T::AccountId) -> VoteWeight
fn vote_weight(who: &T::AccountId) -> VoteWeight
Get the current VoteWeight
of who
.
impl<T> Eq for Pallet<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Pallet<T> where
T: RefUnwindSafe,
impl<T> Send for Pallet<T> where
T: Send,
impl<T> Sync for Pallet<T> where
T: Sync,
impl<T> Unpin for Pallet<T> where
T: Unpin,
impl<T> UnwindSafe for Pallet<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> 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>
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
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