pub struct Pallet<T>(/* private fields */);
Expand description
The Pallet
struct, the main type that implements traits and standalone
functions within the pallet.
Implementations§
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn signed_submissions() -> SignedSubmissions<T>
pub fn signed_submissions() -> SignedSubmissions<T>
Self
accessor for SignedSubmission<T>
.
sourcepub fn finalize_signed_phase() -> bool
pub fn finalize_signed_phase() -> bool
Finish the signed phase. Process the signed submissions from best to worse until a valid one is found, rewarding the best one and slashing the invalid ones along the way.
Returns true if we have a good solution in the signed phase.
This drains the SignedSubmissions
, potentially storing the best valid one in
QueuedSolution
.
This is a self-weighing function, it automatically registers its weight internally when being called.
sourcepub fn finalize_signed_phase_accept_solution(
ready_solution: ReadySolution<T::AccountId, T::MaxWinners>,
who: &T::AccountId,
deposit: BalanceOf<T>,
call_fee: BalanceOf<T>,
)
pub fn finalize_signed_phase_accept_solution( ready_solution: ReadySolution<T::AccountId, T::MaxWinners>, who: &T::AccountId, deposit: BalanceOf<T>, call_fee: BalanceOf<T>, )
Helper function for the case where a solution is accepted in the signed phase.
Extracted to facilitate with weight calculation.
Infallible
sourcepub fn finalize_signed_phase_reject_solution(
who: &T::AccountId,
deposit: BalanceOf<T>,
)
pub fn finalize_signed_phase_reject_solution( who: &T::AccountId, deposit: BalanceOf<T>, )
Helper function for the case where a solution is accepted in the rejected phase.
Extracted to facilitate with weight calculation.
Infallible
sourcepub fn solution_weight_of(
raw_solution: &RawSolution<SolutionOf<T::MinerConfig>>,
size: SolutionOrSnapshotSize,
) -> Weight
pub fn solution_weight_of( raw_solution: &RawSolution<SolutionOf<T::MinerConfig>>, size: SolutionOrSnapshotSize, ) -> Weight
The weight of the given raw solution.
sourcepub fn deposit_for(
raw_solution: &RawSolution<SolutionOf<T::MinerConfig>>,
size: SolutionOrSnapshotSize,
) -> BalanceOf<T>
pub fn deposit_for( raw_solution: &RawSolution<SolutionOf<T::MinerConfig>>, size: SolutionOrSnapshotSize, ) -> BalanceOf<T>
Collect a sufficient deposit to store this solution.
The deposit is composed of 3 main elements:
- base deposit, fixed for all submissions.
- a per-byte deposit, for renting the state usage.
- a per-weight deposit, for the potential weight usage in an upcoming on_initialize
source§impl<T: Config + CreateInherent<Call<T>>> Pallet<T>
impl<T: Config + CreateInherent<Call<T>>> Pallet<T>
sourcepub fn mine_solution() -> Result<(RawSolution<SolutionOf<T::MinerConfig>>, SolutionOrSnapshotSize, TrimmingStatus), MinerError>
pub fn mine_solution() -> Result<(RawSolution<SolutionOf<T::MinerConfig>>, SolutionOrSnapshotSize, TrimmingStatus), MinerError>
Mine a new npos solution.
The Npos Solver type, S
, must have the same AccountId and Error type as the
crate::Config::Solver
in order to create a unified return type.
sourcepub fn restore_or_compute_then_maybe_submit() -> Result<(), MinerError>
pub fn restore_or_compute_then_maybe_submit() -> Result<(), MinerError>
Attempt to restore a solution from cache. Otherwise, compute it fresh. Either way, submit if our call’s score is greater than that of the cached solution.
sourcepub fn mine_check_save_submit() -> Result<(), MinerError>
pub fn mine_check_save_submit() -> Result<(), MinerError>
Mine a new solution, cache it, and submit it back to the chain as an unsigned transaction.
sourcepub fn mine_checked_call() -> Result<Call<T>, MinerError>
pub fn mine_checked_call() -> Result<Call<T>, MinerError>
Mine a new solution as a call. Performs all checks.
pub fn basic_checks( raw_solution: &RawSolution<SolutionOf<T::MinerConfig>>, solution_type: &str, ) -> Result<(), MinerError>
sourcepub fn mine_and_check() -> Result<(RawSolution<SolutionOf<T::MinerConfig>>, SolutionOrSnapshotSize, TrimmingStatus), MinerError>
pub fn mine_and_check() -> Result<(RawSolution<SolutionOf<T::MinerConfig>>, SolutionOrSnapshotSize, TrimmingStatus), MinerError>
Mine a new npos solution, with all the relevant checks to make sure that it will be accepted to the chain.
If you want an unchecked solution, use Pallet::mine_solution
.
If you want a checked solution and submit it at the same time, use
Pallet::mine_check_save_submit
.
sourcepub fn ensure_offchain_repeat_frequency(
now: BlockNumberFor<T>,
) -> Result<(), MinerError>
pub fn ensure_offchain_repeat_frequency( now: BlockNumberFor<T>, ) -> Result<(), MinerError>
Checks if an execution of the offchain worker is permitted at the given block number, or not.
This makes sure that
- we don’t run on previous blocks in case of a re-org
- we don’t run twice within a window of length
T::OffchainRepeat
.
Returns Ok(())
if offchain worker limit is respected, Err(reason)
otherwise. If Ok()
is returned, now
is written in storage and will be used in further calls as the baseline.
sourcepub fn unsigned_pre_dispatch_checks(
raw_solution: &RawSolution<SolutionOf<T::MinerConfig>>,
) -> DispatchResult
pub fn unsigned_pre_dispatch_checks( raw_solution: &RawSolution<SolutionOf<T::MinerConfig>>, ) -> DispatchResult
Do the basics checks that MUST happen during the validation and pre-dispatch of an unsigned transaction.
Can optionally also be called during dispatch, if needed.
NOTE: Ideally, these tests should move more and more outside of this and more to the miner’s code, so that we do less and less storage reads here.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn submit_unsigned(
origin: OriginFor<T>,
raw_solution: Box<RawSolution<SolutionOf<T::MinerConfig>>>,
witness: SolutionOrSnapshotSize,
) -> DispatchResult
pub fn submit_unsigned( origin: OriginFor<T>, raw_solution: Box<RawSolution<SolutionOf<T::MinerConfig>>>, witness: SolutionOrSnapshotSize, ) -> DispatchResult
Submit a solution for the unsigned phase.
The dispatch origin fo this call must be none.
This submission is checked on the fly. Moreover, this unsigned solution is only validated when submitted to the pool from the local node. Effectively, this means that only active validators can submit this transaction when authoring a block (similar to an inherent).
To prevent any incorrect solution (and thus wasted time/weight), this transaction will panic if the solution submitted by the validator is invalid in any way, effectively putting their authoring reward at risk.
No deposit or reward is associated with this submission.
sourcepub fn set_minimum_untrusted_score(
origin: OriginFor<T>,
maybe_next_score: Option<ElectionScore>,
) -> DispatchResult
pub fn set_minimum_untrusted_score( origin: OriginFor<T>, maybe_next_score: Option<ElectionScore>, ) -> DispatchResult
Set a new value for MinimumUntrustedScore
.
Dispatch origin must be aligned with T::ForceOrigin
.
This check can be turned off by setting the value to None
.
sourcepub fn set_emergency_election_result(
origin: OriginFor<T>,
supports: Supports<T::AccountId>,
) -> DispatchResult
pub fn set_emergency_election_result( origin: OriginFor<T>, supports: Supports<T::AccountId>, ) -> DispatchResult
Set a solution in the queue, to be handed out to the client of this pallet in the next
call to ElectionProvider::elect
.
This can only be set by T::ForceOrigin
, and only when the phase is Emergency
.
The solution is not checked for any feasibility and is assumed to be trustworthy, as any feasibility check itself can in principle cause the election process to fail (due to memory/weight constrains).
sourcepub fn submit(
origin: OriginFor<T>,
raw_solution: Box<RawSolution<SolutionOf<T::MinerConfig>>>,
) -> DispatchResult
pub fn submit( origin: OriginFor<T>, raw_solution: Box<RawSolution<SolutionOf<T::MinerConfig>>>, ) -> DispatchResult
Submit a solution for the signed phase.
The dispatch origin fo this call must be signed.
The solution is potentially queued, based on the claimed score and processed at the end of the signed phase.
A deposit is reserved and recorded for the solution. Based on the outcome, the solution might be rewarded, slashed, or get all or a part of the deposit back.
sourcepub fn governance_fallback(
origin: OriginFor<T>,
maybe_max_voters: Option<u32>,
maybe_max_targets: Option<u32>,
) -> DispatchResult
pub fn governance_fallback( origin: OriginFor<T>, maybe_max_voters: Option<u32>, maybe_max_targets: Option<u32>, ) -> DispatchResult
Trigger the governance fallback.
This can only be called when Phase::Emergency
is enabled, as an alternative to
calling Call::set_emergency_election_result
.
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
sourcepub fn round() -> u32
pub fn round() -> u32
Internal counter for the number of rounds.
This is useful for de-duplication of transactions submitted to the pool, and general diagnostics of the pallet.
This is merely incremented once per every time that an upstream elect
is called.
sourcepub fn current_phase() -> Phase<BlockNumberFor<T>>
pub fn current_phase() -> Phase<BlockNumberFor<T>>
Current phase.
sourcepub fn queued_solution() -> Option<ReadySolution<T::AccountId, T::MaxWinners>>
pub fn queued_solution() -> Option<ReadySolution<T::AccountId, T::MaxWinners>>
Current best solution, signed or unsigned, queued to be returned upon elect
.
Always sorted by score.
sourcepub fn snapshot() -> Option<RoundSnapshot<T::AccountId, VoterOf<T>>>
pub fn snapshot() -> Option<RoundSnapshot<T::AccountId, VoterOf<T>>>
Snapshot data of the round.
This is created at the beginning of the signed phase and cleared upon calling elect
.
Note: This storage type must only be mutated through SnapshotWrapper
.
sourcepub fn desired_targets() -> Option<u32>
pub fn desired_targets() -> Option<u32>
Desired number of targets to elect for this round.
Only exists when Snapshot
is present.
Note: This storage type must only be mutated through SnapshotWrapper
.
sourcepub fn snapshot_metadata() -> Option<SolutionOrSnapshotSize>
pub fn snapshot_metadata() -> Option<SolutionOrSnapshotSize>
The metadata of the RoundSnapshot
Only exists when Snapshot
is present.
Note: This storage type must only be mutated through SnapshotWrapper
.
sourcepub fn minimum_untrusted_score() -> Option<ElectionScore>
pub fn minimum_untrusted_score() -> Option<ElectionScore>
The minimum score that each ‘untrusted’ solution must attain in order to be considered feasible.
Can be set via set_minimum_untrusted_score
.
sourcepub fn create_snapshot() -> Result<(), ElectionError<T>>
pub fn create_snapshot() -> Result<(), ElectionError<T>>
Creates the snapshot. Writes new data to:
Returns Ok(())
if operation is okay.
This is a self-weighing function, it will register its own extra weight as
[DispatchClass::Mandatory
] with the system pallet.
sourcepub fn feasibility_check(
raw_solution: RawSolution<SolutionOf<T::MinerConfig>>,
compute: ElectionCompute,
) -> Result<ReadySolution<T::AccountId, T::MaxWinners>, FeasibilityError>
pub fn feasibility_check( raw_solution: RawSolution<SolutionOf<T::MinerConfig>>, compute: ElectionCompute, ) -> Result<ReadySolution<T::AccountId, T::MaxWinners>, FeasibilityError>
Checks the feasibility of a solution.
Trait Implementations§
source§impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>
impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>
source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
source§impl<T> Benchmarking for Pallet<T>where
T: Config + Config,
impl<T> Benchmarking for Pallet<T>where
T: Config + Config,
source§impl<T: Config> ElectionProvider for Pallet<T>
impl<T: Config> ElectionProvider for Pallet<T>
source§impl<T: Config> ElectionProviderBase for Pallet<T>
impl<T: Config> ElectionProviderBase for Pallet<T>
§type BlockNumber = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
type BlockNumber = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
§type Error = ElectionError<T>
type Error = ElectionError<T>
§type MaxWinners = <T as Config>::MaxWinners
type MaxWinners = <T as Config>::MaxWinners
§type DataProvider = <T as Config>::DataProvider
type DataProvider = <T as Config>::DataProvider
§fn desired_targets_checked() -> Result<u32, &'static str>
fn desired_targets_checked() -> Result<u32, &'static str>
Self::DataProvider::desired_targets()
ensuring the value never exceeds
[Self::MaxWinners
].source§impl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
§type InCodeStorageVersion = StorageVersion
type InCodeStorageVersion = StorageVersion
source§fn in_code_storage_version() -> Self::InCodeStorageVersion
fn in_code_storage_version() -> Self::InCodeStorageVersion
storage_version
attribute, or
[NoStorageVersionSet
] if the attribute is missing.source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
§fn current_storage_version() -> Self::InCodeStorageVersion
fn current_storage_version() -> Self::InCodeStorageVersion
in_code_storage_version
and will be removed after March 2024.Self::current_storage_version
] instead. Read moresource§impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(now: BlockNumberFor<T>) -> Weight
fn on_initialize(now: BlockNumberFor<T>) -> Weight
source§fn offchain_worker(now: BlockNumberFor<T>)
fn offchain_worker(now: BlockNumberFor<T>)
source§fn integrity_test()
fn integrity_test()
source§fn try_state(_n: BlockNumberFor<T>) -> Result<(), TryRuntimeError>
fn try_state(_n: BlockNumberFor<T>) -> Result<(), TryRuntimeError>
§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
]). Read more§fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executive
pallet. Read moresource§impl<T: Config> IntegrityTest for Pallet<T>
impl<T: Config> IntegrityTest for Pallet<T>
source§fn integrity_test()
fn integrity_test()
Hooks::integrity_test
].source§impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
source§impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize
].source§impl<T: Config> OnGenesis for Pallet<T>
impl<T: Config> OnGenesis for Pallet<T>
source§fn on_genesis()
fn on_genesis()
source§impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize
].source§impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§impl<T: Config> OnRuntimeUpgrade for Pallet<T>
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade
].§fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
pre_upgrade
->
on_runtime_upgrade
-> post_upgrade
hooks for a migration. Read moresource§impl<T: Config> PalletInfoAccess for Pallet<T>
impl<T: Config> PalletInfoAccess for Pallet<T>
source§fn module_name() -> &'static str
fn module_name() -> &'static str
source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
source§impl<T> PartialEq for Pallet<T>
impl<T> PartialEq for Pallet<T>
source§impl<T: Config> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
source§impl<T: Config> ValidateUnsigned for Pallet<T>
impl<T: Config> ValidateUnsigned for Pallet<T>
source§fn validate_unsigned(
source: TransactionSource,
call: &Self::Call,
) -> TransactionValidity
fn validate_unsigned( source: TransactionSource, call: &Self::Call, ) -> TransactionValidity
source§impl<T: Config> WhitelistedStorageKeys for Pallet<T>
impl<T: Config> WhitelistedStorageKeys for Pallet<T>
source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.impl<T> Eq for Pallet<T>
Auto Trait Implementations§
impl<T> Freeze for Pallet<T>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§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>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Conv for T
impl<T> Conv for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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,
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,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
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,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
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) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
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
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§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) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
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
.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
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.