Struct massa_consensus_worker::state::ConsensusState

source ·
pub struct ConsensusState {
Show 25 fields pub config: ConsensusConfig, pub channels: ConsensusChannels, pub storage: Storage, pub genesis_hashes: Vec<BlockId>, pub gi_head: PreHashMap<BlockId, PreHashSet<BlockId>>, pub max_cliques: Vec<Clique>, pub active_index_without_ops: PreHashSet<BlockId>, pub save_final_periods: Vec<u64>, pub latest_final_blocks_periods: Vec<(BlockId, u64)>, pub blocks_state: BlocksState, pub best_parents: Vec<(BlockId, u64)>, pub to_propagate: PreHashMap<BlockId, Storage>, pub attack_attempts: Vec<BlockId>, pub new_final_blocks: PreHashSet<BlockId>, pub new_stale_blocks: PreHashMap<BlockId, (Address, Slot)>, pub launch_time: MassaTime, pub final_block_stats: VecDeque<(MassaTime, Address, bool)>, pub protocol_blocks: VecDeque<(MassaTime, BlockId)>, pub stale_block_stats: VecDeque<MassaTime>, pub stats_history_timespan: MassaTime, pub stats_desync_detection_timespan: MassaTime, pub wishlist: PreHashMap<BlockId, Option<SecuredHeader>>, pub prev_blockclique: PreHashMap<BlockId, Slot>, pub nonfinal_active_blocks_per_slot: HashMap<Slot, PreHashSet<BlockId>>, pub(crate) massa_metrics: MassaMetrics,
}

Fields§

§config: ConsensusConfig

Configuration

§channels: ConsensusChannels

Channels to communicate with other modules

§storage: Storage

Storage

§genesis_hashes: Vec<BlockId>

Block ids of genesis blocks

§gi_head: PreHashMap<BlockId, PreHashSet<BlockId>>

Incompatibility graph: maps a block id to the block ids it is incompatible with One entry per Active Block

§max_cliques: Vec<Clique>

All the cliques

§active_index_without_ops: PreHashSet<BlockId>

ids of active blocks without ops

§save_final_periods: Vec<u64>

Save of latest periods

§latest_final_blocks_periods: Vec<(BlockId, u64)>

One (block id, period) per thread

§blocks_state: BlocksState

All the blocks we know about and their status

§best_parents: Vec<(BlockId, u64)>

One (block id, period) per thread TODO not sure I understand the difference with latest_final_blocks_periods

§to_propagate: PreHashMap<BlockId, Storage>

Blocks that need to be propagated

§attack_attempts: Vec<BlockId>

List of block ids we think are attack attempts

§new_final_blocks: PreHashSet<BlockId>

Newly final blocks

§new_stale_blocks: PreHashMap<BlockId, (Address, Slot)>

Newly stale block mapped to creator and slot

§launch_time: MassaTime

time at which the node was launched (used for de-synchronization detection)

§final_block_stats: VecDeque<(MassaTime, Address, bool)>

Final block stats (time, creator, is_from_protocol)

§protocol_blocks: VecDeque<(MassaTime, BlockId)>

Blocks that come from protocol used for stats and ids are removed when inserted in final_block_stats

§stale_block_stats: VecDeque<MassaTime>

Stale block timestamp

§stats_history_timespan: MassaTime

the time span considered for stats

§stats_desync_detection_timespan: MassaTime

the time span considered for de-synchronization detection

§wishlist: PreHashMap<BlockId, Option<SecuredHeader>>

blocks we want

§prev_blockclique: PreHashMap<BlockId, Slot>

previous blockclique notified to Execution

§nonfinal_active_blocks_per_slot: HashMap<Slot, PreHashSet<BlockId>>

Blocks indexed by slot (used for multi-stake limiting). Blocks should be saved in this map when we receive the header or the full block directly.

§massa_metrics: MassaMetrics

massa metrics

Implementations§

source§

impl ConsensusState

source

pub fn insert_parents_descendants( &mut self, add_block_id: BlockId, add_block_slot: Slot, parents_hash: Vec<BlockId>, )

source

pub fn compute_fitness_find_blockclique( &mut self, add_block_id: &BlockId, ) -> Result<usize, ConsensusError>

source

pub fn list_stale_blocks(&self, fitness_threshold: u64) -> PreHashSet<BlockId>

source

pub fn remove_block(&mut self, add_block_id: &BlockId, block_id: &BlockId)

source

pub fn list_final_blocks(&self) -> Result<PreHashSet<BlockId>, ConsensusError>

source

pub fn get_blockclique(&self) -> PreHashSet<BlockId>

get the clique of higher fitness

source

pub fn mark_final_blocks( &mut self, add_block_id: &BlockId, final_blocks: PreHashSet<BlockId>, ) -> Result<(), ConsensusError>

source§

impl ConsensusState

source

pub fn rec_process( &mut self, to_ack: BTreeSet<(Slot, BlockId)>, current_slot: Option<Slot>, ) -> Result<(), ConsensusError>

Acknowledge a set of items recursively and process them

§Arguments:
  • to_ack: the set of items to acknowledge and process
  • current_slot: the current slot when this function is called
§Returns:

Success or error if an error happened during the processing of items

source

fn process( &mut self, block_id: BlockId, current_slot: Option<Slot>, ) -> Result<BTreeSet<(Slot, BlockId)>, ConsensusError>

Acknowledge a single item, return a set of items to re-ack

§Arguments:
  • block_id: the id of the block to acknowledge
  • current_slot: the current slot when this function is called
§Returns:

A list of items to re-ack and process or an error if the process of an item failed

source

fn add_block_to_graph( &mut self, add_block_id: BlockId, parents_hash_period: Vec<(BlockId, u64)>, add_block_slot: Slot, incomp: PreHashSet<BlockId>, inherited_incomp_count: usize, ) -> Result<(), ConsensusError>

Add a block to the graph and update the cliques, the graph dependencies and incompatibilities

§Arguments:
  • add_block_id: Block id of the block to add
  • parents_hash_period: Ids and periods of the parents of the block to add
  • add_block_creator: Creator of the block to add
  • add_block_slot: Slot of the block to add
  • incomp: Block ids of the blocks incompatible with the block to add
  • fitness: Fitness of the block to add
  • storage: Storage containing all the data of the block to add
§Returns:

Success or error if any steps failed

source

pub fn maybe_note_attack_attempt( &mut self, reason: &DiscardReason, hash: &BlockId, )

Note an attack attempt if the discard reason indicates one.

source

fn notify_execution(&mut self, finalized_blocks: HashMap<Slot, BlockId>)

Notify execution about blockclique changes and finalized blocks.

§Arguments:
  • finalized_blocks: Block that became final and need to be send to execution
source

pub fn block_db_changed(&mut self) -> Result<(), ConsensusError>

call me if the block database changed Processing of final blocks, pruning.

  1. propagate blocks
  2. Notify of attack attempts
  3. get new final blocks
  4. get blockclique
  5. notify Execution
  6. Process new final blocks
  7. Notify pool of new final ops
  8. Notify PoS of final blocks
  9. notify protocol of block wish list
  10. note new latest final periods (prune graph if changed)
  11. add stale blocks to stats
source§

impl ConsensusState

source

pub fn register_block_header( &mut self, block_id: BlockId, header: SecuredHeader, current_slot: Option<Slot>, ) -> Result<(), ConsensusError>

Register a block header in the graph. Ignore genesis hashes.

§Arguments:
  • block_id: the block id
  • header: the header to register
  • current_slot: the slot when this function is called
§Returns:

Success or error if the header is invalid or too old

source

pub fn register_block( &mut self, block_id: BlockId, slot: Slot, current_slot: Option<Slot>, storage: Storage, created: bool, ) -> Result<(), ConsensusError>

Register a new full block in the graph. Ignore genesis hashes.

§Arguments:
  • block_id: the block id
  • slot: the slot of the block
  • current_slot: the slot when this function is called
  • storage: Storage containing the whole content of the block
  • created: is the block created by the node or received from the network
§Returns:

Success or error if the block is invalid or too old

source

pub fn mark_invalid_block(&mut self, block_id: &BlockId, header: SecuredHeader)

Mark a block that is in the graph as invalid.

§Arguments:
  • block_id: Block id of the block to mark as invalid
  • header: Header of the block to mark as invalid
source§

impl ConsensusState

source

fn prune_active( &mut self, ) -> Result<PreHashMap<BlockId, ActiveBlock>, ConsensusError>

prune active blocks and return final blocks, return discarded final blocks

source

fn prune_slot_waiting(&mut self)

source

fn prune_discarded(&mut self) -> Result<(), ConsensusError>

source

fn prune_waiting_for_dependencies(&mut self) -> Result<(), ConsensusError>

source

fn prune_nonfinal_blocks_per_slot(&mut self)

Clear the cache of blocks indexed by slot. Slot are not saved anymore, when the block in the same thread with a equal or greater period is finalized.

source

pub fn prune(&mut self) -> Result<(), ConsensusError>

Clear all the caches and blocks waiting to be processed to avoid too much memory usage.

source§

impl ConsensusState

source

pub fn get_stats(&self) -> Result<ConsensusStats, ConsensusError>

Calculate and return stats about consensus

source

pub fn stats_tick(&mut self) -> Result<(), ConsensusError>

Must be called each tick to update stats. Will detect if a desynchronization happened

source

fn check_desync(&mut self) -> Result<(), ConsensusError>

Helper function for stats_tick. Checks if there are any final blocks is coming from protocol if none => we are probably desync Ignore if we are before the last_start_period

source

fn prune_stats(&mut self) -> Result<(), ConsensusError>

Remove old stats from consensus storage

source§

impl ConsensusState

source

pub fn slot_tick(&mut self, current_slot: Slot) -> Result<(), ConsensusError>

This function should be called each tick and will check if there is a block in the graph that should be processed at this slot, and if so, process it.

§Arguments:
  • current_slot: the current slot
§Returns:

Error if the process of a block returned an error.

source§

impl ConsensusState

source

pub(crate) fn detect_multistake(&mut self, header: &SecuredHeader) -> bool

source

pub(crate) fn convert_block_header( &mut self, block_id: BlockId, header: SecuredHeader, current_slot: Option<Slot>, ) -> Option<BlockStatus>

Check if the header is valid and if it could be processed when we will receive the full block

source

fn convert_to_discard_block_header( &mut self, reason: DiscardReason, block_id: BlockId, header: SecuredHeader, ) -> BlockStatus

Store in our indexes that we discarded this block or block header

§Arguments:

reason: Read of the discard block_id: ID of the block header: header to save

source

pub(crate) fn check_header( &self, block_id: &BlockId, header: &SecuredHeader, current_slot: Option<Slot>, ) -> HeaderCheckOutcome

Process an incoming header.

Checks performed:

  • Number of parents matches thread count.
  • Slot above 0.
  • Valid thread.
  • Check that the block is older than the latest final one in thread.
  • Check if it was the creator’s turn to create this block.
  • Check parents are present.
  • Check the topological consistency of the parents.
  • Check endorsements.
  • Check thread incompatibility test.
  • Check grandpa incompatibility test.
  • Check if the block is incompatible with a parent.
  • Check if the block is incompatible with a final block.
source

pub fn check_endorsements( &self, header: &SecuredHeader, ) -> EndorsementsCheckOutcome

check endorsements:

  • endorser was selected for that (slot, index)
  • endorsed slot is parent_in_own_thread slot
source§

impl ConsensusState

source

pub fn get_full_active_block( &self, block_id: &BlockId, ) -> Option<(&ActiveBlock, &StorageOrBlock)>

Get a full active block

source

fn try_get_full_active_block( &self, block_id: &BlockId, ) -> Result<(&ActiveBlock, &StorageOrBlock), ConsensusError>

Get a full active block

Returns an error if it was not found

source

pub fn get_clique_count(&self) -> usize

source

pub fn get_blockclique_block_at_slot(&self, slot: &Slot) -> Option<BlockId>

get the blockclique (or final) block ID at a given slot, if any

source

pub fn get_latest_blockclique_block_at_slot(&self, slot: &Slot) -> BlockId

get the latest blockclique (or final) block ID at a given slot, if any

source

pub fn get_block_status(&self, block_id: &BlockId) -> BlockGraphStatus

source

fn list_latest_final_blocks_at( &self, slot: Slot, ) -> Result<Vec<(BlockId, u64)>, ConsensusError>

list the latest final blocks at the given slot

exclusively used by list_required_active_blocks

source

fn list_earliest_blocks_of( &self, block_ids: &PreHashSet<BlockId>, end_slot: Option<Slot>, ) -> Result<Vec<(BlockId, u64)>, ConsensusError>

list the earliest blocks of the given block id list

exclusively used by list_required_active_blocks

source

fn add_active_blocks_after( &self, kept_blocks: &mut PreHashSet<BlockId>, lower_bound: &[(BlockId, u64)], end_slot: Option<Slot>, )

adds to the given container every active block coming after the lower bound

exclusively used by list_required_active_blocks

source

pub fn list_required_active_blocks( &self, end_slot: Option<Slot>, ) -> Result<PreHashSet<BlockId>, ConsensusError>

list_required_active_blocks algo:

if end_slot is None: set effective_latest_finals to be the IDs of the self.latest_final_blocks else set effective_latest_finals to be the IDs of the Active Final blocks that have the highest period in each thread but are before end_slot (included)

create a kept_blocks list of block IDs to keep initialize it with effective_latest_finals as well as all the active blocks that are after the effective_latest_finals of their thread (included) (but before end_slot (included) if it is Some)

do the following 2 times: extend kept_blocks with the parents of the current kept_blocks fill holes by adding to kept_blocks all the active block IDs whose slot is after the earliest kept_blocks of their thread (included) (but before end_slot (included) if it is Some)

return kept_blocks

source

pub fn extract_block_graph_part( &self, slot_start: Option<Slot>, slot_end: Option<Slot>, ) -> Result<BlockGraphExport, ConsensusError>

source

pub fn get_all_final_blocks( &self, ) -> HashMap<BlockId, (Slot, ExecutionBlockMetadata)>

Gets all stored final blocks, not only the still-useful ones This is used when initializing Execution from Consensus. Since the Execution bootstrap snapshot is older than the Consensus snapshot, we might need to signal older final blocks for Execution to catch up.

source

pub fn get_block_wishlist( &self, ) -> Result<PreHashMap<BlockId, Option<SecuredHeader>>, ConsensusError>

get the current block wish list, including the operations hash.

source

pub fn get_active_block_and_descendants( &self, block_id: &BlockId, ) -> PreHashSet<BlockId>

Gets a block and all its descendants

§Argument
  • hash : hash of the given block

Trait Implementations§

source§

impl Clone for ConsensusState

source§

fn clone(&self) -> ConsensusState

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

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

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

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

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

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

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

source§

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

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

impl<T> Conv for T

§

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

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

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

§

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

Deserializes using the given deserializer
source§

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

§

impl<T> FmtForward for T

§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

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

impl<T> Instrument for T

§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

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

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

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

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

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

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

impl<T> LayoutRaw for T

§

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

Gets the layout of the type.
§

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

§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Pointee for T

§

type Metadata = ()

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

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

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

Immutable access to a value. Read more
§

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

Mutable access to a value. Read more
§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

impl<T> TryConv for T

§

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.
§

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

§

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

upcast ref
§

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

upcast mut ref
§

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

upcast boxed dyn
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

impl<T> MaybeSendSync for T