Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }
Expand description

Main storage interface for the ethrex client.

The Store provides a high-level API for all blockchain data operations:

  • Block storage and retrieval
  • State trie management
  • Account and storage queries
  • Transaction indexing

§Thread Safety

Store is Clone and thread-safe. All clones share the same underlying database connection and caches via Arc.

§Caching

The store maintains several caches for performance:

  • Trie Layer Cache: Recent trie nodes for fast state access
  • Code Cache: LRU cache for contract bytecode (64MB default)
  • Latest Block Cache: Cached latest block header for RPC

§Example

let store = Store::new("./data", EngineType::RocksDB)?;

// Add a block
store.add_block(block).await?;

// Query account balance
let info = store.get_account_info(block_number, address)?;
let balance = info.map(|a| a.balance).unwrap_or_default();

Implementations§

Source§

impl Store

Source

pub async fn wait_for_persistence_idle(&self) -> Result<(), StoreError>

Block until the trie-update background worker has drained every prior message and is waiting for new work — i.e. Phase 2 (disk write of the bottom-most diff layer) and Phase 3 (in-memory layer removal) for all previously-applied updates have completed.

Implementation: the worker channel is sync_channel(0), so a send only returns once the worker calls recv() on the next loop iteration. TrieMessage::Ping carries no work, so the send completing is itself the idle signal.

Caller’s responsibility: hold off other senders to trie_update_worker_tx while this is in flight. Under concurrent producers the rendezvous guarantee degrades to “the prior message has been drained”, not “persistence is idle going forward” — a racing Update from another thread can be in-flight by the time this returns.

Source

pub async fn add_block(&self, block: Block) -> Result<(), StoreError>

Add a block in a single transaction. This will store -> BlockHeader, BlockBody, BlockTransactions, BlockNumber.

Source

pub async fn add_blocks(&self, blocks: Vec<Block>) -> Result<(), StoreError>

Add a batch of blocks in a single transaction. This will store -> BlockHeader, BlockBody, BlockTransactions, BlockNumber.

Source

pub async fn add_block_header( &self, block_hash: BlockHash, block_header: BlockHeader, ) -> Result<(), StoreError>

Add block header

Source

pub async fn add_block_headers( &self, block_headers: Vec<BlockHeader>, ) -> Result<(), StoreError>

Add a batch of block headers

Source

pub fn get_block_header( &self, block_number: BlockNumber, ) -> Result<Option<BlockHeader>, StoreError>

Obtain canonical block header

Source

pub async fn add_block_body( &self, block_hash: BlockHash, block_body: BlockBody, ) -> Result<(), StoreError>

Add block body

Source

pub async fn get_block_body( &self, block_number: BlockNumber, ) -> Result<Option<BlockBody>, StoreError>

Obtain canonical block body

Source

pub async fn remove_block( &self, block_number: BlockNumber, ) -> Result<(), StoreError>

Remove canonical block

Source

pub async fn get_block_bodies( &self, from: BlockNumber, to: BlockNumber, ) -> Result<Vec<Option<BlockBody>>, StoreError>

Obtain canonical block bodies in from..=to

Source

pub async fn get_block_bodies_by_hash( &self, hashes: Vec<BlockHash>, ) -> Result<Vec<BlockBody>, StoreError>

Obtain block bodies from a list of hashes

Source

pub async fn get_block_body_by_hash( &self, block_hash: BlockHash, ) -> Result<Option<BlockBody>, StoreError>

Obtain any block body using the hash

Source

pub fn get_block_header_by_hash( &self, block_hash: BlockHash, ) -> Result<Option<BlockHeader>, StoreError>

Source

pub fn add_pending_block(&self, block: Block) -> Result<(), StoreError>

Source

pub async fn get_pending_block( &self, block_hash: BlockHash, ) -> Result<Option<Block>, StoreError>

Source

pub async fn add_block_number( &self, block_hash: BlockHash, block_number: BlockNumber, ) -> Result<(), StoreError>

Add block number for a given hash

Source

pub async fn get_block_number( &self, block_hash: BlockHash, ) -> Result<Option<BlockNumber>, StoreError>

Obtain block number for a given hash

Source

pub async fn add_transaction_location( &self, transaction_hash: H256, block_number: BlockNumber, block_hash: BlockHash, index: Index, ) -> Result<(), StoreError>

Store transaction location (block number and index of the transaction within the block)

Source

pub async fn add_transaction_locations( &self, locations: Vec<(H256, BlockNumber, BlockHash, Index)>, ) -> Result<(), StoreError>

Store transaction locations in batch (one db transaction for all)

Source

pub async fn get_transaction_location( &self, transaction_hash: H256, ) -> Result<Option<(BlockNumber, BlockHash, Index)>, StoreError>

Obtain transaction location (block hash and index)

Source

pub async fn add_receipt( &self, block_hash: BlockHash, index: Index, receipt: Receipt, ) -> Result<(), StoreError>

Add receipt

Source

pub async fn add_receipts( &self, block_hash: BlockHash, receipts: Vec<Receipt>, ) -> Result<(), StoreError>

Add receipts

Source

pub async fn get_receipt( &self, block_number: BlockNumber, index: Index, ) -> Result<Option<Receipt>, StoreError>

Obtain receipt for a canonical block represented by the block number.

Source

pub fn get_account_code( &self, code_hash: H256, ) -> Result<Option<Code>, StoreError>

Get account code by its hash.

Check if the code exists in the cache (attribute account_code_cache), if not, reads the database, and if it exists, decodes and returns it.

Source

pub fn code_exists(&self, code_hash: H256) -> Result<bool, StoreError>

Check if account code exists by its hash, without constructing the full Code struct. More efficient than get_account_code for existence checks since it skips RLP decoding and Code struct construction (no jump_targets deserialization). Note: The underlying get() still reads the value from RocksDB (including blob files).

Source

pub fn get_code_metadata( &self, code_hash: H256, ) -> Result<Option<CodeMetadata>, StoreError>

Get code metadata (length) by its hash.

Checks cache first, falls back to database. If metadata is missing, falls back to loading full code and extracts length (auto-migration).

Source

pub async fn add_account_code(&self, code: Code) -> Result<(), StoreError>

Add account code

Source

pub async fn clear_snap_state(&self) -> Result<(), StoreError>

Clears all checkpoint data created during the last snap sync

Source

pub async fn get_transaction_by_hash( &self, transaction_hash: H256, ) -> Result<Option<Transaction>, StoreError>

Source

pub async fn get_transaction_by_location( &self, block_hash: H256, index: u64, ) -> Result<Option<Transaction>, StoreError>

Source

pub async fn get_block_by_hash( &self, block_hash: BlockHash, ) -> Result<Option<Block>, StoreError>

Source

pub async fn get_block_by_number( &self, block_number: BlockNumber, ) -> Result<Option<Block>, StoreError>

Source

pub async fn get_canonical_block_hash( &self, block_number: BlockNumber, ) -> Result<Option<BlockHash>, StoreError>

Source

pub async fn set_chain_config( &mut self, chain_config: &ChainConfig, ) -> Result<(), StoreError>

Stores the chain configuration values, should only be called once after reading the genesis file Ignores previously stored values if present

Source

pub async fn update_earliest_block_number( &self, block_number: BlockNumber, ) -> Result<(), StoreError>

Update earliest block number

Source

pub async fn get_earliest_block_number(&self) -> Result<BlockNumber, StoreError>

Obtain earliest block number

Source

pub async fn get_finalized_block_number( &self, ) -> Result<Option<BlockNumber>, StoreError>

Obtain finalized block number

Source

pub async fn get_safe_block_number( &self, ) -> Result<Option<BlockNumber>, StoreError>

Obtain safe block number

Source

pub async fn get_latest_block_number(&self) -> Result<BlockNumber, StoreError>

Obtain latest block number

Source

pub async fn update_pending_block_number( &self, block_number: BlockNumber, ) -> Result<(), StoreError>

Update pending block number

Source

pub async fn get_pending_block_number( &self, ) -> Result<Option<BlockNumber>, StoreError>

Obtain pending block number

Source

pub async fn get_receipts_for_block( &self, block_hash: &BlockHash, ) -> Result<Vec<Receipt>, StoreError>

Source

pub async fn get_receipts_for_block_from_index( &self, block_hash: &BlockHash, start_index: u64, max_count: Option<usize>, ) -> Result<Vec<Receipt>, StoreError>

Retrieves receipts for a block starting from the given index, optionally limited to max_count receipts.

Uses cursor-based prefix iteration over the 32-byte block hash prefix for efficient batch retrieval. Used by:

  • eth/70 partial receipt requests (EIP-7975) via p2p
  • eth_getTransactionReceipt RPC with a count limit to avoid fetching the entire block’s receipts
Source

pub async fn set_header_download_checkpoint( &self, block_hash: BlockHash, ) -> Result<(), StoreError>

Sets the hash of the last header downloaded during a snap sync

Source

pub async fn get_header_download_checkpoint( &self, ) -> Result<Option<BlockHash>, StoreError>

Gets the hash of the last header downloaded during a snap sync

Source

pub async fn set_latest_valid_ancestor( &self, bad_block: BlockHash, latest_valid: BlockHash, ) -> Result<(), StoreError>

The forkchoice_update and new_payload methods require the latest_valid_hash when processing an invalid payload. To provide this, we must track invalid chains.

We only store the last known valid head upon encountering a bad block, rather than tracking every subsequent invalid block.

Source

pub async fn get_latest_valid_ancestor( &self, block: BlockHash, ) -> Result<Option<BlockHash>, StoreError>

Returns the latest valid ancestor hash for a given invalid block hash. Used to provide latest_valid_hash in the Engine API when processing invalid payloads.

Source

pub fn get_block_number_sync( &self, block_hash: BlockHash, ) -> Result<Option<BlockNumber>, StoreError>

Obtain block number for a given hash

Source

pub fn get_canonical_block_hash_sync( &self, block_number: BlockNumber, ) -> Result<Option<BlockHash>, StoreError>

Get the canonical block hash for a given block number.

Source

pub async fn write_storage_trie_nodes_batch( &self, storage_trie_nodes: StorageUpdates, ) -> Result<(), StoreError>

CAUTION: This method writes directly to the underlying database, bypassing any caching layer. For updating the state after block execution, use Self::store_block_updates.

Source

pub async fn write_account_code_batch( &self, account_codes: Vec<(H256, Code)>, ) -> Result<(), StoreError>

CAUTION: This method writes directly to the underlying database, bypassing any caching layer. For updating the state after block execution, use Self::store_block_updates.

Source

pub fn write( &self, table: &'static str, key: Vec<u8>, value: Vec<u8>, ) -> Result<(), StoreError>

Helper method for async writes Spawns blocking task to avoid blocking tokio runtime

Source

pub async fn read_async( &self, table: &'static str, key: Vec<u8>, ) -> Result<Option<Vec<u8>>, StoreError>

Helper method for async reads Spawns blocking task to avoid blocking tokio runtime

Source

pub fn read( &self, table: &'static str, key: Vec<u8>, ) -> Result<Option<Vec<u8>>, StoreError>

Helper method for sync reads Spawns blocking task to avoid blocking tokio runtime

Source

pub async fn write_batch_async( &self, table: &'static str, batch_ops: Vec<(Vec<u8>, Vec<u8>)>, ) -> Result<(), StoreError>

Helper method for batch writes Spawns blocking task to avoid blocking tokio runtime This is the most important optimization for healing performance

Source

pub fn write_batch( &self, table: &'static str, batch_ops: Vec<(Vec<u8>, Vec<u8>)>, ) -> Result<(), StoreError>

Helper method for batch writes

Source

pub async fn add_fullsync_batch( &self, headers: Vec<BlockHeader>, ) -> Result<(), StoreError>

Source

pub async fn read_fullsync_batch( &self, start: BlockNumber, limit: u64, ) -> Result<Vec<Option<BlockHeader>>, StoreError>

Source

pub async fn clear_fullsync_headers(&self) -> Result<(), StoreError>

Source

pub fn delete( &self, table: &'static str, key: Vec<u8>, ) -> Result<(), StoreError>

Delete a key from a table

Source

pub fn store_block_updates( &self, update_batch: UpdateBatch, ) -> Result<(), StoreError>

Source

pub fn new( path: impl AsRef<Path>, engine_type: EngineType, ) -> Result<Self, StoreError>

Opens (or creates) a store at path with the default StoreConfig.

Production callers that need to override storage tunables (e.g. the RocksDB block cache size from a CLI option) should use Store::new_with_config.

Source

pub fn new_with_config( path: impl AsRef<Path>, engine_type: EngineType, config: StoreConfig, ) -> Result<Self, StoreError>

Opens (or creates) a store at path, applying the supplied StoreConfig.

Source

pub async fn new_from_genesis( store_path: &Path, engine_type: EngineType, genesis_path: &str, ) -> Result<Self, StoreError>

Opens (or creates) a store at store_path and seeds it from the given genesis file, using the default StoreConfig.

Source

pub async fn new_from_genesis_with_config( store_path: &Path, engine_type: EngineType, genesis_path: &str, config: StoreConfig, ) -> Result<Self, StoreError>

Opens (or creates) a store at store_path from genesis, applying the supplied StoreConfig.

Source

pub async fn get_account_info( &self, block_number: BlockNumber, address: Address, ) -> Result<Option<AccountInfo>, StoreError>

Source

pub fn get_account_info_by_hash( &self, block_hash: BlockHash, address: Address, ) -> Result<Option<AccountInfo>, StoreError>

Source

pub fn get_account_state_by_acc_hash( &self, block_hash: BlockHash, account_hash: H256, ) -> Result<Option<AccountState>, StoreError>

Source

pub async fn get_fork_id(&self) -> Result<ForkId, StoreError>

Source

pub async fn get_code_by_account_address( &self, block_number: BlockNumber, address: Address, ) -> Result<Option<Code>, StoreError>

Source

pub async fn get_nonce_by_account_address( &self, block_number: BlockNumber, address: Address, ) -> Result<Option<u64>, StoreError>

Source

pub fn apply_account_updates_batch( &self, block_hash: BlockHash, account_updates: &[AccountUpdate], ) -> Result<Option<AccountUpdatesList>, StoreError>

Applies account updates based on the block’s latest storage state and returns the new state root after the updates have been applied.

Source

pub fn apply_account_updates_from_trie_batch<'a>( &self, state_trie: &mut Trie, account_updates: impl IntoIterator<Item = &'a AccountUpdate>, ) -> Result<AccountUpdatesList, StoreError>

Source

pub fn apply_account_updates_from_trie_with_witness( &self, state_trie: Trie, account_updates: &[AccountUpdate], storage_tries: HashMap<Address, (TrieWitness, Trie)>, ) -> Result<(HashMap<Address, (TrieWitness, Trie)>, AccountUpdatesList), StoreError>

Performs the same actions as apply_account_updates_from_trie but also returns the used storage tries with witness recorded

Source

pub async fn setup_genesis_state_trie( &self, genesis_accounts: BTreeMap<Address, GenesisAccount>, ) -> Result<H256, StoreError>

Adds all genesis accounts and returns the genesis block’s state_root

Source

pub fn store_witness( &self, block_hash: BlockHash, block_number: u64, witness: ExecutionWitness, ) -> Result<(), StoreError>

Stores a pre-serialized execution witness for a block.

The witness is converted to RPC format (RpcExecutionWitness) before storage to avoid expensive encode_subtrie traversal on every read. This pre-computes the serialization at write time instead of read time.

Source

pub fn get_witness_json_bytes( &self, block_number: u64, block_hash: BlockHash, ) -> Result<Option<Vec<u8>>, StoreError>

Returns the raw JSON bytes of a cached witness for a block.

This is the most efficient method for the RPC handler since it avoids deserialization and re-serialization. The bytes can be parsed directly as a JSON Value for the RPC response.

Source

pub fn get_witness_by_number_and_hash( &self, block_number: u64, block_hash: BlockHash, ) -> Result<Option<RpcExecutionWitness>, StoreError>

Returns the deserialized RpcExecutionWitness for a block.

Prefer get_witness_json_bytes when you need to return the witness as JSON (e.g., for RPC responses) to avoid re-serialization.

Source

pub fn store_block_access_list( &self, block_hash: BlockHash, bal: &BlockAccessList, ) -> Result<(), StoreError>

Stores a block access list for a given block hash.

Source

pub fn get_block_access_list( &self, block_hash: BlockHash, ) -> Result<Option<BlockAccessList>, StoreError>

Returns the block access list for a given block hash, if stored.

Source

pub async fn add_initial_state( &mut self, genesis: Genesis, ) -> Result<(), StoreError>

Source

pub async fn add_initial_state_skip_validation( &mut self, genesis: Genesis, ) -> Result<(), StoreError>

Like Store::add_initial_state, but trusts a pre-existing datadir’s state instead of validating it against the provided genesis. If a genesis header is already stored, it is kept as-is rather than recomputing the genesis state root from genesis.alloc and rejecting on mismatch. The chain config from the genesis file is still applied either way.

Intended for booting a datadir produced out-of-band (e.g. by a state generator that writes the state trie directly and emits a genesis file with an empty alloc), where the operator vouches for the stored state root. Has no effect on a fresh datadir: the genesis is built normally.

Source

pub async fn load_initial_state(&self) -> Result<(), StoreError>

Source

pub fn get_storage_at( &self, block_number: BlockNumber, address: Address, storage_key: H256, ) -> Result<Option<U256>, StoreError>

Source

pub fn get_storage_at_root( &self, state_root: H256, address: Address, storage_key: H256, ) -> Result<Option<U256>, StoreError>

Source

pub fn get_storage_at_root_with_known_storage_root( &self, state_root: H256, account_hash: H256, storage_root: H256, storage_key: H256, ) -> Result<Option<U256>, StoreError>

Gets storage value when the account hash and storage root are already known.

This skips the state-trie account lookup and account RLP decode done by Self::get_storage_at_root, and directly opens the account storage trie.

Source

pub fn get_chain_config(&self) -> ChainConfig

Source

pub async fn get_latest_canonical_block_hash( &self, ) -> Result<Option<BlockHash>, StoreError>

Source

pub async fn forkchoice_update( &self, new_canonical_blocks: Vec<(BlockNumber, BlockHash)>, head_number: BlockNumber, head_hash: BlockHash, safe: Option<BlockNumber>, finalized: Option<BlockNumber>, ) -> Result<(), StoreError>

Updates the canonical chain. Inserts new canonical blocks, removes blocks beyond the new head, and updates the head, safe, and finalized block pointers. All operations are performed in a single database transaction.

Source

pub fn state_trie( &self, block_hash: BlockHash, ) -> Result<Option<Trie>, StoreError>

Obtain the storage trie for the given block

Source

pub fn storage_trie( &self, block_hash: BlockHash, address: Address, ) -> Result<Option<Trie>, StoreError>

Obtain the storage trie for the given account on the given block

Source

pub async fn get_account_state( &self, block_number: BlockNumber, address: Address, ) -> Result<Option<AccountState>, StoreError>

Source

pub fn get_account_state_by_root( &self, state_root: H256, address: Address, ) -> Result<Option<AccountState>, StoreError>

Source

pub fn get_account_state_from_trie( &self, state_trie: &Trie, address: Address, ) -> Result<Option<AccountState>, StoreError>

Source

pub async fn get_account_proof( &self, state_root: H256, address: Address, storage_keys: &[H256], ) -> Result<Option<AccountProof>, StoreError>

Constructs a merkle proof for the given account address against a given state. If storage_keys are provided, also constructs the storage proofs for those keys.

Returns None if the state trie is missing, otherwise returns the proof.

Source

pub fn iter_accounts_from( &self, state_root: H256, starting_address: H256, ) -> Result<impl Iterator<Item = (H256, AccountState)>, StoreError>

Source

pub fn iter_accounts( &self, state_root: H256, ) -> Result<impl Iterator<Item = (H256, AccountState)>, StoreError>

Source

pub fn iter_storage_from( &self, state_root: H256, hashed_address: H256, starting_slot: H256, ) -> Result<Option<impl Iterator<Item = (H256, U256)>>, StoreError>

Source

pub fn iter_storage( &self, state_root: H256, hashed_address: H256, ) -> Result<Option<impl Iterator<Item = (H256, U256)>>, StoreError>

Source

pub fn get_account_range_proof( &self, state_root: H256, starting_hash: H256, last_hash: Option<H256>, ) -> Result<Vec<Vec<u8>>, StoreError>

Source

pub fn get_storage_range_proof( &self, state_root: H256, hashed_address: H256, starting_hash: H256, last_hash: Option<H256>, ) -> Result<Option<Vec<Vec<u8>>>, StoreError>

Source

pub fn get_trie_nodes( &self, state_root: H256, paths: Vec<Vec<u8>>, byte_limit: u64, ) -> Result<Vec<Vec<u8>>, StoreError>

Receives the root of the state trie and a list of paths where the first path will correspond to a path in the state trie (aka a hashed account address) and the following paths will be paths in the account’s storage trie (aka hashed storage keys) If only one hash (account) is received, then the state trie node containing the account will be returned. If more than one hash is received, then the storage trie nodes where each storage key is stored will be returned For more information check out snap capability message GetTrieNodes The paths can be either full paths (hash) or partial paths (compact-encoded nibbles), if a partial path is given for the account this method will not return storage nodes for it

Source

pub fn new_state_trie_for_test(&self) -> Result<Trie, StoreError>

Creates a new state trie with an empty state root, for testing purposes only

Source

pub fn open_state_trie(&self, state_root: H256) -> Result<Trie, StoreError>

Obtain a state trie from the given state root Doesn’t check if the state root is valid Used for internal store operations

Source

pub fn open_direct_state_trie( &self, state_root: H256, ) -> Result<Trie, StoreError>

Obtain a state trie from the given state root Doesn’t check if the state root is valid Used for internal store operations

Source

pub fn open_locked_state_trie( &self, state_root: H256, ) -> Result<Trie, StoreError>

Obtain a state trie locked for reads from the given state root Doesn’t check if the state root is valid Used for internal store operations

Source

pub fn open_storage_trie( &self, account_hash: H256, state_root: H256, storage_root: H256, ) -> Result<Trie, StoreError>

Obtain a storage trie from the given address and storage_root. Doesn’t check if the account is stored

Source

pub fn open_direct_storage_trie( &self, account_hash: H256, storage_root: H256, ) -> Result<Trie, StoreError>

Obtain a storage trie from the given address and storage_root. Doesn’t check if the account is stored

Source

pub fn open_locked_storage_trie( &self, account_hash: H256, state_root: H256, storage_root: H256, ) -> Result<Trie, StoreError>

Obtain a read-locked storage trie from the given address and storage_root. Doesn’t check if the account is stored

Source

pub fn has_state_root(&self, state_root: H256) -> Result<bool, StoreError>

Source

pub fn ancestors(&self, block_hash: BlockHash) -> AncestorIterator

Takes a block hash and returns an iterator to its ancestors. Block headers are returned in reverse order, starting from the given block and going up to the genesis block.

Source

pub fn is_canonical_sync( &self, block_hash: BlockHash, ) -> Result<bool, StoreError>

Checks if a given block belongs to the current canonical chain. Returns false if the block is not known

Source

pub fn generate_flatkeyvalue(&self) -> Result<(), StoreError>

Source

pub fn create_checkpoint( &self, path: impl AsRef<Path>, ) -> Result<(), StoreError>

Source

pub fn get_store_directory(&self) -> Result<PathBuf, StoreError>

Source

pub fn last_written(&self) -> Result<Vec<u8>, StoreError>

Trait Implementations§

Source§

impl Clone for Store

Source§

fn clone(&self) -> Store

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Store

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Store

§

impl !UnwindSafe for Store

§

impl Freeze for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

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
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

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

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> LayoutRaw for T

Source§

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

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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