Struct zebra_state::service::non_finalized_state::chain::Chain
source · pub struct Chain {
network: Network,
inner: ChainInner,
pub(super) last_fork_height: Option<Height>,
}
Expand description
A single non-finalized partial chain, from the child of the finalized tip, to a non-finalized chain tip.
Fields§
§network: Network
The configured network for this chain.
inner: ChainInner
The internal state of this chain.
last_fork_height: Option<Height>
The last height this chain forked at. Diagnostics only.
This field is only used for metrics. It is not consensus-critical, and it is not checked for equality.
We keep the same last fork height in both sides of a clone, because every new block clones a chain, even if it’s just growing that chain.
§Note
Most diagnostics are implemented on the NonFinalizedState
, rather than each chain. Some
diagnostics only use the best chain, and others need to modify the Chain state, but that’s
difficult with Arc<Chain>
s.
Implementations§
source§impl Chain
impl Chain
sourcepub(crate) fn new(
network: &Network,
finalized_tip_height: Height,
sprout_note_commitment_tree: Arc<NoteCommitmentTree>,
sapling_note_commitment_tree: Arc<NoteCommitmentTree>,
orchard_note_commitment_tree: Arc<NoteCommitmentTree>,
history_tree: Arc<HistoryTree>,
finalized_tip_chain_value_pools: ValueBalance<NonNegative>,
) -> Self
pub(crate) fn new( network: &Network, finalized_tip_height: Height, sprout_note_commitment_tree: Arc<NoteCommitmentTree>, sapling_note_commitment_tree: Arc<NoteCommitmentTree>, orchard_note_commitment_tree: Arc<NoteCommitmentTree>, history_tree: Arc<HistoryTree>, finalized_tip_chain_value_pools: ValueBalance<NonNegative>, ) -> Self
Create a new Chain with the given finalized tip trees and network.
sourcepub fn eq_internal_state(&self, other: &Chain) -> bool
pub fn eq_internal_state(&self, other: &Chain) -> bool
Is the internal state of self
the same as other
?
Chain
has custom Eq
and Ord
implementations based on proof of work,
which are used to select the best chain. So we can’t derive Eq
for Chain
.
Unlike the custom trait impls, this method returns true
if the entire internal state
of two chains is equal.
If the internal states are different, it returns false
,
even if the blocks in the two chains are equal.
sourcepub fn recent_fork_height(&self) -> Option<Height>
pub fn recent_fork_height(&self) -> Option<Height>
Returns the last fork height if that height is still in the non-finalized state.
Otherwise, if that fork has been finalized, returns None
.
sourcepub fn recent_fork_length(&self) -> Option<u32>
pub fn recent_fork_length(&self) -> Option<u32>
Returns this chain fork’s length, if its fork is still in the non-finalized state.
Otherwise, if the fork has been finalized, returns None
.
sourcepub fn push(
self,
block: ContextuallyVerifiedBlock,
) -> Result<Chain, ValidateContextError>
pub fn push( self, block: ContextuallyVerifiedBlock, ) -> Result<Chain, ValidateContextError>
Push a contextually valid non-finalized block into this chain as the new tip.
If the block is invalid, drops this chain, and returns an error.
Note: a ContextuallyVerifiedBlock
isn’t actually contextually valid until
Self::update_chain_tip_with
returns success.
sourcepub(crate) fn pop_root(&mut self) -> (ContextuallyVerifiedBlock, Treestate)
pub(crate) fn pop_root(&mut self) -> (ContextuallyVerifiedBlock, Treestate)
Pops the lowest height block of the non-finalized portion of a chain, and returns it with its associated treestate.
sourcepub fn non_finalized_root_height(&self) -> Height
pub fn non_finalized_root_height(&self) -> Height
Returns the height of the chain root.
sourcepub fn fork(&self, fork_tip: Hash) -> Option<Self>
pub fn fork(&self, fork_tip: Hash) -> Option<Self>
Fork and return a chain at the block with the given fork_tip
, if it is part of this
chain. Otherwise, if this chain does not contain fork_tip
, returns None
.
sourcepub fn block(
&self,
hash_or_height: HashOrHeight,
) -> Option<&ContextuallyVerifiedBlock>
pub fn block( &self, hash_or_height: HashOrHeight, ) -> Option<&ContextuallyVerifiedBlock>
Returns the ContextuallyVerifiedBlock
with block::Hash
or
Height
, if it exists in this chain.
sourcepub fn transaction(&self, hash: Hash) -> Option<(&Arc<Transaction>, Height)>
pub fn transaction(&self, hash: Hash) -> Option<(&Arc<Transaction>, Height)>
Returns the Transaction
with transaction::Hash
, if it exists in this chain.
sourcepub fn transaction_by_loc(
&self,
tx_loc: TransactionLocation,
) -> Option<&Arc<Transaction>>
pub fn transaction_by_loc( &self, tx_loc: TransactionLocation, ) -> Option<&Arc<Transaction>>
Returns the Transaction
at TransactionLocation
, if it exists in this chain.
sourcepub fn transaction_hash_by_loc(
&self,
tx_loc: TransactionLocation,
) -> Option<&Hash>
pub fn transaction_hash_by_loc( &self, tx_loc: TransactionLocation, ) -> Option<&Hash>
Returns the transaction::Hash
for the transaction at TransactionLocation
,
if it exists in this chain.
sourcepub fn transaction_hashes_for_block(
&self,
hash_or_height: HashOrHeight,
) -> Option<Arc<[Hash]>>
pub fn transaction_hashes_for_block( &self, hash_or_height: HashOrHeight, ) -> Option<Arc<[Hash]>>
Returns the transaction::Hash
es in the block with hash_or_height
,
if it exists in this chain.
Hashes are returned in block order.
Returns None
if the block is not found.
sourcepub fn hash_by_height(&self, height: Height) -> Option<Hash>
pub fn hash_by_height(&self, height: Height) -> Option<Hash>
Returns the block::Hash
for height
, if it exists in this chain.
sourcepub fn height_by_hash(&self, hash: Hash) -> Option<Height>
pub fn height_by_hash(&self, hash: Hash) -> Option<Height>
Returns the Height
for hash
, if it exists in this chain.
sourcepub fn contains_block_hash(&self, hash: Hash) -> bool
pub fn contains_block_hash(&self, hash: Hash) -> bool
Returns true is the chain contains the given block hash. Returns false otherwise.
sourcepub fn contains_block_height(&self, height: Height) -> bool
pub fn contains_block_height(&self, height: Height) -> bool
Returns true is the chain contains the given block height. Returns false otherwise.
sourcepub fn contains_hash_or_height(
&self,
hash_or_height: impl Into<HashOrHeight>,
) -> bool
pub fn contains_hash_or_height( &self, hash_or_height: impl Into<HashOrHeight>, ) -> bool
Returns true is the chain contains the given block hash or height. Returns false otherwise.
sourcepub fn non_finalized_tip(&self) -> (Height, Hash)
pub fn non_finalized_tip(&self) -> (Height, Hash)
Returns the non-finalized tip block height and hash.
sourcepub fn non_finalized_tip_with_value_balance(
&self,
) -> (Height, Hash, ValueBalance<NonNegative>)
pub fn non_finalized_tip_with_value_balance( &self, ) -> (Height, Hash, ValueBalance<NonNegative>)
Returns the non-finalized tip block height, hash, and total pool value balances.
sourcepub fn sprout_note_commitment_tree_for_tip(&self) -> Arc<NoteCommitmentTree>
pub fn sprout_note_commitment_tree_for_tip(&self) -> Arc<NoteCommitmentTree>
Returns the Sprout note commitment tree of the tip of this Chain
,
including all finalized notes, and the non-finalized notes in this chain.
If the chain is empty, instead returns the tree of the finalized tip,
which was supplied in Chain::new()
§Panics
If this chain has no sprout trees. (This should be impossible.)
sourcepub fn sprout_tree(
&self,
hash_or_height: HashOrHeight,
) -> Option<Arc<NoteCommitmentTree>>
pub fn sprout_tree( &self, hash_or_height: HashOrHeight, ) -> Option<Arc<NoteCommitmentTree>>
Returns the Sprout NoteCommitmentTree
specified by
a HashOrHeight
, if it exists in the non-finalized Chain
.
sourcefn add_sprout_tree_and_anchor(
&mut self,
height: Height,
tree: Arc<NoteCommitmentTree>,
)
fn add_sprout_tree_and_anchor( &mut self, height: Height, tree: Arc<NoteCommitmentTree>, )
Adds the Sprout tree
to the tree and anchor indexes at height
.
height
can be either:
- the height of a new block that has just been added to the chain tip, or
- the finalized tip height—the height of the parent of the first block of a new chain.
Stores only the first tree in each series of identical trees.
§Panics
- If there’s a tree already stored at
height
. - If there’s an anchor already stored at
height
.
sourcefn remove_sprout_tree_and_anchor(
&mut self,
position: RevertPosition,
height: Height,
)
fn remove_sprout_tree_and_anchor( &mut self, position: RevertPosition, height: Height, )
Removes the Sprout tree and anchor indexes at height
.
height
can be at two different RevertPosition
s in the chain:
-
a tip block above a chain fork—only the tree and anchor at that height are removed, or
-
a root block—all trees and anchors at and below that height are removed, including temporary finalized tip trees.
§Panics
-
If the anchor being removed is not present.
-
If there is no tree at
height
.
sourcepub fn sapling_note_commitment_tree_for_tip(&self) -> Arc<NoteCommitmentTree>
pub fn sapling_note_commitment_tree_for_tip(&self) -> Arc<NoteCommitmentTree>
Returns the Sapling note commitment tree of the tip of this Chain
,
including all finalized notes, and the non-finalized notes in this chain.
If the chain is empty, instead returns the tree of the finalized tip,
which was supplied in Chain::new()
§Panics
If this chain has no sapling trees. (This should be impossible.)
sourcepub fn sapling_tree(
&self,
hash_or_height: HashOrHeight,
) -> Option<Arc<NoteCommitmentTree>>
pub fn sapling_tree( &self, hash_or_height: HashOrHeight, ) -> Option<Arc<NoteCommitmentTree>>
Returns the Sapling NoteCommitmentTree
specified
by a HashOrHeight
, if it exists in the non-finalized Chain
.
sourcepub fn sapling_subtree(
&self,
hash_or_height: HashOrHeight,
) -> Option<NoteCommitmentSubtree<Node>>
pub fn sapling_subtree( &self, hash_or_height: HashOrHeight, ) -> Option<NoteCommitmentSubtree<Node>>
Returns the Sapling NoteCommitmentSubtree
that was completed at a block with
HashOrHeight
, if it exists in the non-finalized Chain
.
§Concurrency
This method should not be used to get subtrees in concurrent code by height, because the same heights in different chain forks can have different subtrees.
sourcepub fn sapling_subtrees_in_range(
&self,
range: impl RangeBounds<NoteCommitmentSubtreeIndex>,
) -> BTreeMap<NoteCommitmentSubtreeIndex, NoteCommitmentSubtreeData<Node>>
pub fn sapling_subtrees_in_range( &self, range: impl RangeBounds<NoteCommitmentSubtreeIndex>, ) -> BTreeMap<NoteCommitmentSubtreeIndex, NoteCommitmentSubtreeData<Node>>
Returns a list of Sapling NoteCommitmentSubtree
s in the provided range.
Unlike the finalized state and ReadRequest::SaplingSubtrees
, the returned subtrees
can start after start_index
. These subtrees are continuous up to the tip.
There is no API for retrieving single subtrees by index, because it can accidentally be used to create an inconsistent list of subtrees after concurrent non-finalized and finalized updates.
sourcepub fn sapling_subtree_for_tip(&self) -> Option<NoteCommitmentSubtree<Node>>
pub fn sapling_subtree_for_tip(&self) -> Option<NoteCommitmentSubtree<Node>>
Returns the Sapling NoteCommitmentSubtree
if it was completed at the tip height.
sourcefn add_sapling_tree_and_anchor(
&mut self,
height: Height,
tree: Arc<NoteCommitmentTree>,
)
fn add_sapling_tree_and_anchor( &mut self, height: Height, tree: Arc<NoteCommitmentTree>, )
Adds the Sapling tree
to the tree and anchor indexes at height
.
height
can be either:
- the height of a new block that has just been added to the chain tip, or
- the finalized tip height—the height of the parent of the first block of a new chain.
Stores only the first tree in each series of identical trees.
§Panics
- If there’s a tree already stored at
height
. - If there’s an anchor already stored at
height
.
sourcefn remove_sapling_tree_and_anchor(
&mut self,
position: RevertPosition,
height: Height,
)
fn remove_sapling_tree_and_anchor( &mut self, position: RevertPosition, height: Height, )
Removes the Sapling tree and anchor indexes at height
.
height
can be at two different RevertPosition
s in the chain:
-
a tip block above a chain fork—only the tree and anchor at that height are removed, or
-
a root block—all trees and anchors at and below that height are removed, including temporary finalized tip trees.
§Panics
-
If the anchor being removed is not present.
-
If there is no tree at
height
.
sourcepub fn orchard_note_commitment_tree_for_tip(&self) -> Arc<NoteCommitmentTree>
pub fn orchard_note_commitment_tree_for_tip(&self) -> Arc<NoteCommitmentTree>
Returns the Orchard note commitment tree of the tip of this Chain
,
including all finalized notes, and the non-finalized notes in this chain.
If the chain is empty, instead returns the tree of the finalized tip,
which was supplied in Chain::new()
§Panics
If this chain has no orchard trees. (This should be impossible.)
sourcepub fn orchard_tree(
&self,
hash_or_height: HashOrHeight,
) -> Option<Arc<NoteCommitmentTree>>
pub fn orchard_tree( &self, hash_or_height: HashOrHeight, ) -> Option<Arc<NoteCommitmentTree>>
Returns the Orchard
NoteCommitmentTree
specified by a
HashOrHeight
, if it exists in the non-finalized Chain
.
sourcepub fn orchard_subtree(
&self,
hash_or_height: HashOrHeight,
) -> Option<NoteCommitmentSubtree<Node>>
pub fn orchard_subtree( &self, hash_or_height: HashOrHeight, ) -> Option<NoteCommitmentSubtree<Node>>
Returns the Orchard NoteCommitmentSubtree
that was completed at a block with
HashOrHeight
, if it exists in the non-finalized Chain
.
§Concurrency
This method should not be used to get subtrees in concurrent code by height, because the same heights in different chain forks can have different subtrees.
sourcepub fn orchard_subtrees_in_range(
&self,
range: impl RangeBounds<NoteCommitmentSubtreeIndex>,
) -> BTreeMap<NoteCommitmentSubtreeIndex, NoteCommitmentSubtreeData<Node>>
pub fn orchard_subtrees_in_range( &self, range: impl RangeBounds<NoteCommitmentSubtreeIndex>, ) -> BTreeMap<NoteCommitmentSubtreeIndex, NoteCommitmentSubtreeData<Node>>
Returns a list of Orchard NoteCommitmentSubtree
s in the provided range.
Unlike the finalized state and ReadRequest::OrchardSubtrees
, the returned subtrees
can start after start_index
. These subtrees are continuous up to the tip.
There is no API for retrieving single subtrees by index, because it can accidentally be used to create an inconsistent list of subtrees after concurrent non-finalized and finalized updates.
sourcepub fn orchard_subtree_for_tip(&self) -> Option<NoteCommitmentSubtree<Node>>
pub fn orchard_subtree_for_tip(&self) -> Option<NoteCommitmentSubtree<Node>>
Returns the Orchard NoteCommitmentSubtree
if it was completed at the tip height.
sourcefn add_orchard_tree_and_anchor(
&mut self,
height: Height,
tree: Arc<NoteCommitmentTree>,
)
fn add_orchard_tree_and_anchor( &mut self, height: Height, tree: Arc<NoteCommitmentTree>, )
Adds the Orchard tree
to the tree and anchor indexes at height
.
height
can be either:
- the height of a new block that has just been added to the chain tip, or
- the finalized tip height—the height of the parent of the first block of a new chain.
Stores only the first tree in each series of identical trees.
§Panics
- If there’s a tree already stored at
height
. - If there’s an anchor already stored at
height
.
sourcefn remove_orchard_tree_and_anchor(
&mut self,
position: RevertPosition,
height: Height,
)
fn remove_orchard_tree_and_anchor( &mut self, position: RevertPosition, height: Height, )
Removes the Orchard tree and anchor indexes at height
.
height
can be at two different RevertPosition
s in the chain:
-
a tip block above a chain fork—only the tree and anchor at that height are removed, or
-
a root block—all trees and anchors at and below that height are removed, including temporary finalized tip trees.
§Panics
-
If the anchor being removed is not present.
-
If there is no tree at
height
.
sourcepub fn history_block_commitment_tree(&self) -> Arc<HistoryTree>
pub fn history_block_commitment_tree(&self) -> Arc<HistoryTree>
Returns the History tree of the tip of this Chain
,
including all finalized blocks, and the non-finalized blocks below the chain tip.
If the chain is empty, instead returns the tree of the finalized tip,
which was supplied in Chain::new()
§Panics
If this chain has no history trees. (This should be impossible.)
sourcepub fn history_tree(
&self,
hash_or_height: HashOrHeight,
) -> Option<Arc<HistoryTree>>
pub fn history_tree( &self, hash_or_height: HashOrHeight, ) -> Option<Arc<HistoryTree>>
Returns the HistoryTree
specified by a HashOrHeight
, if it
exists in the non-finalized Chain
.
sourcefn add_history_tree(&mut self, height: Height, tree: Arc<HistoryTree>)
fn add_history_tree(&mut self, height: Height, tree: Arc<HistoryTree>)
Add the History tree
to the history tree index at height
.
height
can be either:
- the height of a new block that has just been added to the chain tip, or
- the finalized tip height: the height of the parent of the first block of a new chain.
sourcefn remove_history_tree(&mut self, position: RevertPosition, height: Height)
fn remove_history_tree(&mut self, position: RevertPosition, height: Height)
Remove the History tree index at height
.
height
can be at two different RevertPosition
s in the chain:
- a tip block above a chain fork: only that height is removed, or
- a root block: all trees below that height are removed, including temporary finalized tip trees.
fn treestate(&self, hash_or_height: HashOrHeight) -> Option<Treestate>
sourcepub fn non_finalized_tip_hash(&self) -> Hash
pub fn non_finalized_tip_hash(&self) -> Hash
Returns the block hash of the tip block.
sourcepub fn non_finalized_root(&self) -> (Hash, Height)
pub fn non_finalized_root(&self) -> (Hash, Height)
Returns the non-finalized root block hash and height.
sourcepub fn non_finalized_root_hash(&self) -> Hash
pub fn non_finalized_root_hash(&self) -> Hash
Returns the block hash of the non-finalized root block.
sourcepub fn non_finalized_nth_hash(&self, n: usize) -> Option<Hash>
pub fn non_finalized_nth_hash(&self, n: usize) -> Option<Hash>
Returns the block hash of the n
th block from the non-finalized root.
This is the block at non_finalized_root_height() + n
.
sourcepub fn non_finalized_tip_height(&self) -> Height
pub fn non_finalized_tip_height(&self) -> Height
Return the non-finalized tip height for this chain.
§Panics
Panics if called while the chain is empty, or while the chain is updating its internal state with the first block.
sourcefn max_block_height(&self) -> Option<Height>
fn max_block_height(&self) -> Option<Height>
Return the non-finalized tip height for this chain,
or None
if self.blocks
is empty.
sourcepub fn tip_block(&self) -> Option<&ContextuallyVerifiedBlock>
pub fn tip_block(&self) -> Option<&ContextuallyVerifiedBlock>
Return the non-finalized tip block for this chain,
or None
if self.blocks
is empty.
sourcepub fn unspent_utxos(&self) -> HashMap<OutPoint, OrderedUtxo>
pub fn unspent_utxos(&self) -> HashMap<OutPoint, OrderedUtxo>
Returns the unspent transaction outputs (UTXOs) in this non-finalized chain.
Callers should also check the finalized state for available UTXOs. If UTXOs remain unspent when a block is finalized, they are stored in the finalized state, and removed from the relevant chain(s).
sourcepub fn created_utxo(&self, outpoint: &OutPoint) -> Option<Utxo>
pub fn created_utxo(&self, outpoint: &OutPoint) -> Option<Utxo>
Returns the transparent::Utxo
pointed to by the given
transparent::OutPoint
if it was created by this chain.
UTXOs are returned regardless of whether they have been spent.
sourcepub fn partial_transparent_indexes<'a>(
&'a self,
addresses: &'a HashSet<Address>,
) -> impl Iterator<Item = &TransparentTransfers>
pub fn partial_transparent_indexes<'a>( &'a self, addresses: &'a HashSet<Address>, ) -> impl Iterator<Item = &TransparentTransfers>
Returns the transparent transfers for addresses
in this non-finalized chain.
If none of the addresses have an address index, returns an empty iterator.
§Correctness
Callers should apply the returned indexes to the corresponding finalized state indexes.
The combined result will only be correct if the chains match. The exact type of match varies by query.
sourcepub fn partial_transparent_balance_change(
&self,
addresses: &HashSet<Address>,
) -> Amount<NegativeAllowed>
pub fn partial_transparent_balance_change( &self, addresses: &HashSet<Address>, ) -> Amount<NegativeAllowed>
Returns the transparent balance change for addresses
in this non-finalized chain.
If the balance doesn’t change for any of the addresses, returns zero.
§Correctness
Callers should apply this balance change to the finalized state balance for addresses
.
The total balance will only be correct if this partial chain matches the finalized state. Specifically, the root of this partial chain must be a child block of the finalized tip.
sourcepub fn partial_transparent_utxo_changes(
&self,
addresses: &HashSet<Address>,
) -> (BTreeMap<OutputLocation, Output>, BTreeSet<OutputLocation>)
pub fn partial_transparent_utxo_changes( &self, addresses: &HashSet<Address>, ) -> (BTreeMap<OutputLocation, Output>, BTreeSet<OutputLocation>)
Returns the transparent UTXO changes for addresses
in this non-finalized chain.
If the UTXOs don’t change for any of the addresses, returns empty lists.
§Correctness
Callers should apply these non-finalized UTXO changes to the finalized state UTXOs.
The UTXOs will only be correct if the non-finalized chain matches or overlaps with the finalized state.
Specifically, a block in the partial chain must be a child block of the finalized tip. (But the child block does not have to be the partial chain root.)
sourcepub fn partial_transparent_tx_ids(
&self,
addresses: &HashSet<Address>,
query_height_range: RangeInclusive<Height>,
) -> BTreeMap<TransactionLocation, Hash>
pub fn partial_transparent_tx_ids( &self, addresses: &HashSet<Address>, query_height_range: RangeInclusive<Height>, ) -> BTreeMap<TransactionLocation, Hash>
Returns the transaction::Hash
es used by addresses
to receive or spend funds,
in the non-finalized chain, filtered using the query_height_range
.
If none of the addresses receive or spend funds in this partial chain, returns an empty list.
§Correctness
Callers should combine these non-finalized transactions with the finalized state transactions.
The transaction IDs will only be correct if the non-finalized chain matches or overlaps with the finalized state.
Specifically, a block in the partial chain must be a child block of the finalized tip. (But the child block does not have to be the partial chain root.)
This condition does not apply if there is only one address. Since address transactions are only appended by blocks, and the finalized state query reads them in order, it is impossible to get inconsistent transactions for a single address.
sourcefn update_chain_tip_with_block_parallel(
&mut self,
contextually_valid: &ContextuallyVerifiedBlock,
) -> Result<(), ValidateContextError>
fn update_chain_tip_with_block_parallel( &mut self, contextually_valid: &ContextuallyVerifiedBlock, ) -> Result<(), ValidateContextError>
Update the chain tip with the contextually_valid
block,
running note commitment tree updates in parallel with other updates.
Used to implement update_chain_tip_with::<ContextuallyVerifiedBlock>
.
sourcefn update_chain_tip_with_block_except_trees(
&mut self,
contextually_valid: &ContextuallyVerifiedBlock,
) -> Result<(), ValidateContextError>
fn update_chain_tip_with_block_except_trees( &mut self, contextually_valid: &ContextuallyVerifiedBlock, ) -> Result<(), ValidateContextError>
Update the chain tip with the contextually_valid
block,
except for the note commitment and history tree updates.
Used to implement update_chain_tip_with::<ContextuallyVerifiedBlock>
.
Trait Implementations§
source§impl Ord for Chain
impl Ord for Chain
source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Chain order for the NonFinalizedState
’s chain_set
.
Chains with higher cumulative Proof of Work are Ordering::Greater
,
breaking ties using the tip block hash.
Despite the consensus rules, Zebra uses the tip block hash as a
tie-breaker. Zebra blocks are downloaded in parallel, so download
timestamps may not be unique. (And Zebra currently doesn’t track
download times, because Block
s are immutable.)
This departure from the consensus rules may delay network convergence, for as long as the greater hash belongs to the later mined block. But Zebra nodes should converge as soon as the tied work is broken.
“At a given point in time, each full validator is aware of a set of candidate blocks. These form a tree rooted at the genesis block, where each node in the tree refers to its parent via the hashPrevBlock block header field.
A path from the root toward the leaves of the tree consisting of a sequence of one or more valid blocks consistent with consensus rules, is called a valid block chain.
In order to choose the best valid block chain in its view of the overall block tree, a node sums the work … of all blocks in each valid block chain, and considers the valid block chain with greatest total work to be best.
To break ties between leaf blocks, a node will prefer the block that it received first.
The consensus protocol is designed to ensure that for any given block height, the vast majority of nodes should eventually agree on their best valid block chain up to that height.“
https://zips.z.cash/protocol/protocol.pdf#blockchain
§Correctness
Chain::cmp
is used in a BTreeSet
, so the fields accessed by cmp
must not have
interior mutability.
§Panics
If two chains compare equal.
This panic enforces the NonFinalizedState::chain_set
unique chain invariant.
If the chain set contains duplicate chains, the non-finalized state might handle new blocks or block finalization incorrectly.
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for Chain
impl PartialEq for Chain
source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Chain equality for NonFinalizedState::chain_set
, using proof of
work, then the tip block hash as a tie-breaker.
§Panics
If two chains compare equal.
See Chain::cmp
for details.
source§impl PartialOrd for Chain
impl PartialOrd for Chain
source§impl UpdateWith<(&Vec<Input>, &Hash, &HashMap<OutPoint, OrderedUtxo>)> for Chain
impl UpdateWith<(&Vec<Input>, &Hash, &HashMap<OutPoint, OrderedUtxo>)> for Chain
source§fn update_chain_tip_with(
&mut self,
(spending_inputs, spending_tx_hash, spent_outputs): &(&Vec<Input>, &Hash, &HashMap<OutPoint, OrderedUtxo>),
) -> Result<(), ValidateContextError>
fn update_chain_tip_with( &mut self, (spending_inputs, spending_tx_hash, spent_outputs): &(&Vec<Input>, &Hash, &HashMap<OutPoint, OrderedUtxo>), ) -> Result<(), ValidateContextError>
T
is added to the chain tip,
update Chain
cumulative data members to add data that are derived from T
.source§fn revert_chain_with(
&mut self,
(spending_inputs, spending_tx_hash, spent_outputs): &(&Vec<Input>, &Hash, &HashMap<OutPoint, OrderedUtxo>),
position: RevertPosition,
)
fn revert_chain_with( &mut self, (spending_inputs, spending_tx_hash, spent_outputs): &(&Vec<Input>, &Hash, &HashMap<OutPoint, OrderedUtxo>), position: RevertPosition, )
T
is removed from position
in the chain,
revert Chain
cumulative data members to remove data that are derived from T
.source§impl UpdateWith<(&Vec<Output>, &Hash, &HashMap<OutPoint, OrderedUtxo>)> for Chain
impl UpdateWith<(&Vec<Output>, &Hash, &HashMap<OutPoint, OrderedUtxo>)> for Chain
source§fn update_chain_tip_with(
&mut self,
(created_outputs, creating_tx_hash, block_created_outputs): &(&Vec<Output>, &Hash, &HashMap<OutPoint, OrderedUtxo>),
) -> Result<(), ValidateContextError>
fn update_chain_tip_with( &mut self, (created_outputs, creating_tx_hash, block_created_outputs): &(&Vec<Output>, &Hash, &HashMap<OutPoint, OrderedUtxo>), ) -> Result<(), ValidateContextError>
T
is added to the chain tip,
update Chain
cumulative data members to add data that are derived from T
.source§fn revert_chain_with(
&mut self,
(created_outputs, creating_tx_hash, block_created_outputs): &(&Vec<Output>, &Hash, &HashMap<OutPoint, OrderedUtxo>),
position: RevertPosition,
)
fn revert_chain_with( &mut self, (created_outputs, creating_tx_hash, block_created_outputs): &(&Vec<Output>, &Hash, &HashMap<OutPoint, OrderedUtxo>), position: RevertPosition, )
T
is removed from position
in the chain,
revert Chain
cumulative data members to remove data that are derived from T
.source§impl UpdateWith<ContextuallyVerifiedBlock> for Chain
impl UpdateWith<ContextuallyVerifiedBlock> for Chain
source§fn update_chain_tip_with(
&mut self,
contextually_valid: &ContextuallyVerifiedBlock,
) -> Result<(), ValidateContextError>
fn update_chain_tip_with( &mut self, contextually_valid: &ContextuallyVerifiedBlock, ) -> Result<(), ValidateContextError>
T
is added to the chain tip,
update Chain
cumulative data members to add data that are derived from T
.source§fn revert_chain_with(
&mut self,
contextually_valid: &ContextuallyVerifiedBlock,
position: RevertPosition,
)
fn revert_chain_with( &mut self, contextually_valid: &ContextuallyVerifiedBlock, position: RevertPosition, )
T
is removed from position
in the chain,
revert Chain
cumulative data members to remove data that are derived from T
.source§impl UpdateWith<Option<JoinSplitData<Groth16Proof>>> for Chain
impl UpdateWith<Option<JoinSplitData<Groth16Proof>>> for Chain
source§fn revert_chain_with(
&mut self,
joinsplit_data: &Option<JoinSplitData<Groth16Proof>>,
_position: RevertPosition,
)
fn revert_chain_with( &mut self, joinsplit_data: &Option<JoinSplitData<Groth16Proof>>, _position: RevertPosition, )
§Panics
Panics if any nullifier is missing from the chain when we try to remove it.
See check::nullifier::remove_from_non_finalized_chain
for details.
source§fn update_chain_tip_with(
&mut self,
joinsplit_data: &Option<JoinSplitData<Groth16Proof>>,
) -> Result<(), ValidateContextError>
fn update_chain_tip_with( &mut self, joinsplit_data: &Option<JoinSplitData<Groth16Proof>>, ) -> Result<(), ValidateContextError>
T
is added to the chain tip,
update Chain
cumulative data members to add data that are derived from T
.source§impl<AnchorV> UpdateWith<Option<ShieldedData<AnchorV>>> for Chainwhere
AnchorV: AnchorVariant + Clone,
impl<AnchorV> UpdateWith<Option<ShieldedData<AnchorV>>> for Chainwhere
AnchorV: AnchorVariant + Clone,
source§fn revert_chain_with(
&mut self,
sapling_shielded_data: &Option<ShieldedData<AnchorV>>,
_position: RevertPosition,
)
fn revert_chain_with( &mut self, sapling_shielded_data: &Option<ShieldedData<AnchorV>>, _position: RevertPosition, )
§Panics
Panics if any nullifier is missing from the chain when we try to remove it.
See check::nullifier::remove_from_non_finalized_chain
for details.
source§fn update_chain_tip_with(
&mut self,
sapling_shielded_data: &Option<ShieldedData<AnchorV>>,
) -> Result<(), ValidateContextError>
fn update_chain_tip_with( &mut self, sapling_shielded_data: &Option<ShieldedData<AnchorV>>, ) -> Result<(), ValidateContextError>
T
is added to the chain tip,
update Chain
cumulative data members to add data that are derived from T
.source§impl UpdateWith<Option<ShieldedData>> for Chain
impl UpdateWith<Option<ShieldedData>> for Chain
source§fn revert_chain_with(
&mut self,
orchard_shielded_data: &Option<ShieldedData>,
_position: RevertPosition,
)
fn revert_chain_with( &mut self, orchard_shielded_data: &Option<ShieldedData>, _position: RevertPosition, )
§Panics
Panics if any nullifier is missing from the chain when we try to remove it.
See check::nullifier::remove_from_non_finalized_chain
for details.
source§fn update_chain_tip_with(
&mut self,
orchard_shielded_data: &Option<ShieldedData>,
) -> Result<(), ValidateContextError>
fn update_chain_tip_with( &mut self, orchard_shielded_data: &Option<ShieldedData>, ) -> Result<(), ValidateContextError>
T
is added to the chain tip,
update Chain
cumulative data members to add data that are derived from T
.source§impl UpdateWith<ValueBalance<NegativeAllowed>> for Chain
impl UpdateWith<ValueBalance<NegativeAllowed>> for Chain
source§fn revert_chain_with(
&mut self,
block_value_pool_change: &ValueBalance<NegativeAllowed>,
position: RevertPosition,
)
fn revert_chain_with( &mut self, block_value_pool_change: &ValueBalance<NegativeAllowed>, position: RevertPosition, )
Revert the chain state using a block chain value pool change.
When forking from the tip, subtract the block’s chain value pool change.
When finalizing the root, leave the chain value pool balances unchanged.
ChainInner::chain_value_pools
tracks the chain value pools for all finalized blocks, and
the non-finalized blocks in this chain. So finalizing the root doesn’t change the set of
blocks it tracks.
§Panics
Panics if the chain pool value balance is invalid after we subtract the block value pool change.
source§fn update_chain_tip_with(
&mut self,
block_value_pool_change: &ValueBalance<NegativeAllowed>,
) -> Result<(), ValidateContextError>
fn update_chain_tip_with( &mut self, block_value_pool_change: &ValueBalance<NegativeAllowed>, ) -> Result<(), ValidateContextError>
T
is added to the chain tip,
update Chain
cumulative data members to add data that are derived from T
.impl Eq for Chain
Auto Trait Implementations§
impl Freeze for Chain
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnwindSafe for Chain
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Conv for T
impl<T> Conv for T
§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
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<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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg
] or
a color-specific method, such as [OwoColorize::green
], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg
] or
a color-specific method, such as [OwoColorize::on_yellow
], Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§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
source§impl<Response, Error> ResponseResult<Response, Error> for Response
impl<Response, Error> ResponseResult<Response, Error> for Response
source§fn into_result(self) -> Result<Response, Error>
fn into_result(self) -> Result<Response, Error>
Result
that can be sent as a response.§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.