Shell

Struct Shell 

Source
pub struct Shell<D = PersistentDB, H = Sha256Hasher>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,
{ pub chain_id: ChainId, pub state: FullAccessState<D, H>, pub vp_wasm_cache: VpCache<WasmCacheRwAccess>, pub tx_wasm_cache: TxCache<WasmCacheRwAccess>, pub scheduled_migration: Option<ScheduledMigration>, pub blocks_between_snapshots: Option<NonZeroU64>, pub syncing: Option<SnapshotSync>, /* private fields */ }

Fields§

§chain_id: ChainId

The id of the current chain

§state: FullAccessState<D, H>

The persistent storage with write log

§vp_wasm_cache: VpCache<WasmCacheRwAccess>

VP WASM compilation cache

§tx_wasm_cache: TxCache<WasmCacheRwAccess>

Tx WASM compilation cache

§scheduled_migration: Option<ScheduledMigration>

A migration that can be scheduled at a given block height

§blocks_between_snapshots: Option<NonZeroU64>

When set, indicates after how many blocks a new snapshot will be taken (counting from the first block)

§syncing: Option<SnapshotSync>

Data for a node downloading and apply snapshots as part of the fast sync protocol.

Implementations§

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn finalize_block( &mut self, req: FinalizeBlock, ) -> ShellResult<FinalizeBlock>

Updates the chain with new header, height, etc. Also keeps track of epoch changes and applies associated updates to validator sets, etc. as necessary.

Apply the transactions included in the block.

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn init_chain(&mut self, init: InitChain) -> ShellResult<InitChain>

Create a new genesis for the chain with specified id. This includes

  1. A set of initial users and tokens
  2. Setting up the validity predicates for both users and tokens
  3. Validators
  4. The PoS system
  5. The Ethereum bridge parameters

INVARIANT: This method must not commit the state changes to DB.

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn prepare_proposal(&self, req: RequestPrepareProposal) -> PrepareProposal

Begin a new block.

Block construction is documented in block_alloc and block_alloc::states (private modules).

INVARIANT: Any changes applied in this method must be reverted if the proposal is rejected (unless we can simply overwrite them in the next block). Furthermore, protocol transactions cannot affect the ability of a tx to pay its wrapper fees.

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn verify_header(&self, _req: VerifyHeader) -> VerifyHeader

INVARIANT: This method must be stateless.

Source

pub fn process_proposal( &self, req: RequestProcessProposal, ) -> (ProcessProposal, Vec<TxResult>)

Check all the txs in a block. Some txs may be incorrect, but we only reject the entire block if the order of the included txs violates the order decided upon in the previous block.

Source

pub fn process_txs( &self, txs: &[TxBytes], block_time: DateTimeUtc, block_proposer: &Address, ) -> Vec<TxResult>

Evaluates the corresponding TxResult for each tx in the proposal.

ProcessProposal should be able to make a decision on whether a proposed block is acceptable or not based solely on what this function returns.

Source

pub fn check_proposal_tx<CA>( &self, tx_bytes: &[u8], tx_index: &TxIndex, metadata: &mut ValidationMeta, temp_state: &mut TempWlState<'static, D, H>, block_time: DateTimeUtc, vp_wasm_cache: &mut VpCache<CA>, tx_wasm_cache: &mut TxCache<CA>, block_proposer: &Address, ) -> TxResult
where CA: 'static + WasmCacheAccess + Sync,

Checks if the Tx can be deserialized from bytes. Checks the fees and signatures of the fee payer for a transaction if it is a wrapper tx.

Checks validity of an inner tx.

Error codes: 0: Ok 1: Wasm runtime error 2: Invalid tx 3: Tx is invalidly signed 4: Block is full 5: Replay attempt 6. Tx targets a different chain id 7. Tx is expired 8. Tx exceeds the gas limit 9. Tx failed to pay fees 10. An error in the vote extensions included in the proposal 11. Not enough block space was available for some tx 12. Tx wasm code is not allowlisted

INVARIANT: This function should not, under any circumstances, modify the state since the proposal could be rejected.

Source

pub fn revert_proposal(&mut self, _req: RevertProposal) -> RevertProposal

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn query(&self, query: Query) -> Query

Uses path in the query to forward the request to the right query method and returns the result (which may be the default if path is not a supported string. INVARIANT: This method must be stateless.

Source

pub fn get_balance(&self, token: &Address, owner: &Address) -> Amount

Simple helper function for the ledger to get balances of the specified token at the specified address

Source§

impl Shell<PersistentDB, Sha256Hasher>

Source

pub fn list_snapshots(&self) -> ListSnapshots

List the snapshot files held locally. Furthermore, the number of chunks, as hash of each chunk, and a hash of the chunk metadata are provided so that syncing nodes can verify snapshots they receive.

Source

pub fn load_snapshot_chunk(&self, req: LoadSnapshotChunk) -> LoadSnapshotChunk

Load the bytes of a requested chunk and return them to cometbft.

Source

pub fn offer_snapshot(&mut self, req: OfferSnapshot) -> OfferSnapshot

Decide if a snapshot should be accepted to sync the node forward in time

Source

pub fn apply_snapshot_chunk( &mut self, req: ApplySnapshotChunk, ) -> ApplySnapshotChunk

Write a snapshot chunk to the database

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn validate_bp_roots_vext_list<'iter>( &'iter self, vote_extensions: impl IntoIterator<Item = Signed<Vext>> + 'iter, ) -> impl Iterator<Item = Result<Signed<Vext>, VoteExtensionError>> + 'iter

Takes an iterator over Bridge pool root vote extension instances, and returns another iterator. The latter yields valid Bridge pool root vote extensions, or the reason why these are invalid, in the form of a VoteExtensionError.

Source

pub fn filter_invalid_bp_roots_vexts<'iter>( &'iter self, vote_extensions: impl IntoIterator<Item = Signed<Vext>> + 'iter, ) -> impl Iterator<Item = Signed<Vext>> + 'iter

Takes a list of signed Bridge pool root vote extensions, and filters out invalid instances. This also de-duplicates the iterator to be unique per validator address.

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn new_ethereum_events(&mut self) -> Vec<EthereumEvent>

Checks the channel from the Ethereum oracle monitoring the fullnode and retrieves all seen Ethereum events.

Source

pub fn validate_eth_events_vext_list<'iter>( &'iter self, vote_extensions: impl IntoIterator<Item = Signed<Vext>> + 'iter, ) -> impl Iterator<Item = Result<Signed<Vext>, VoteExtensionError>> + 'iter

Takes an iterator over Ethereum events vote extension instances, and returns another iterator. The latter yields valid Ethereum events vote extensions, or the reason why these are invalid, in the form of a VoteExtensionError.

Source

pub fn filter_invalid_eth_events_vexts<'iter>( &'iter self, vote_extensions: impl IntoIterator<Item = Signed<Vext>> + 'iter, ) -> impl Iterator<Item = Signed<Vext>> + 'iter

Takes a list of signed Ethereum events vote extensions, and filters out invalid instances.

Source

pub fn compress_ethereum_events( &self, vote_extensions: Vec<Signed<Vext>>, ) -> Option<VextDigest>

Compresses a set of signed Ethereum events into a single ethereum_events::VextDigest, whilst filtering invalid Signed<ethereum_events::Vext> instances in the process.

When vote extensions are being used, this performs a check that at least 2/3 of the validators by voting power have included ethereum events in their vote extension.

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn validate_valset_upd_vext_list( &self, vote_extensions: impl IntoIterator<Item = SignedVext> + 'static, ) -> impl Iterator<Item = Result<SignedVext, VoteExtensionError>> + '_

Takes an iterator over validator set update vote extension instances, and returns another iterator. The latter yields valid validator set update vote extensions, or the reason why these are invalid, in the form of a VoteExtensionError.

Source

pub fn filter_invalid_valset_upd_vexts( &self, vote_extensions: impl IntoIterator<Item = SignedVext> + 'static, ) -> impl Iterator<Item = SignedVext> + '_

Takes a list of signed validator set update vote extensions, and filters out invalid instances.

Source

pub fn compress_valset_updates( &self, vote_extensions: Vec<SignedVext>, ) -> Option<VextDigest>

Compresses a set of signed validator set update vote extensions into a single validator_set_update::VextDigest, whilst filtering invalid validator_set_update::SignedVext instances in the process.

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn craft_extension(&mut self) -> VoteExtension

Creates the data to be added to a vote extension.

INVARIANT: This method must be stateless.

Source

pub fn extend_vote_with_ethereum_events(&mut self) -> Option<Signed<Vext>>

Extend PreCommit votes with ethereum_events::Vext instances.

Source

pub fn sign_ethereum_events( &self, ethereum_events: Vec<EthereumEvent>, ) -> Option<Signed<Vext>>

Sign the given Ethereum events, and return the associated vote extension protocol transaction.

Source

pub fn extend_vote_with_bp_roots(&self) -> Option<Signed<Vext>>

Extend PreCommit votes with bridge_pool_roots::Vext instances.

Source

pub fn extend_vote_with_valset_update(&self) -> Option<SignedVext>

Extend PreCommit votes with validator_set_update::Vext instances.

Source

pub fn deserialize_vote_extensions<'shell>( &'shell self, txs: &'shell mut Vec<TxBytes>, ) -> DrainFilter<'shell, TxBytes, impl FnMut(&mut TxBytes) -> bool + 'shell>

Given a slice of TxBytes, return an iterator over the ones we could deserialize to vote extension protocol txs.

Source§

impl Shell<PersistentDB, Sha256Hasher>

Source

pub fn restore_database_from_state_sync(&mut self)

Restore the database with data fetched from the State Sync protocol.

Source§

impl<D, H> Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static, H: StorageHasher + Sync + 'static,

Source

pub fn new( config: Ledger, wasm_dir: PathBuf, broadcast_sender: UnboundedSender<Vec<u8>>, eth_oracle: Option<EthereumOracleChannels>, db_cache: Option<&D::Cache>, scheduled_migration: Option<ScheduledMigration>, vp_wasm_compilation_cache: u64, tx_wasm_compilation_cache: u64, ) -> Self

Create a new shell from a path to a database and a chain id. Looks up the database with this data and tries to load the last state.

Source

pub fn event_log(&self) -> &EventLog

Return a reference to the EventLog.

Source

pub fn event_log_mut(&mut self) -> &mut EventLog

Return a mutable reference to the EventLog.

Source

pub fn last_state(&self, namada_version: &str) -> Info

Load the Merkle root hash and the height of the last committed block, if any. This is returned when ABCI sends an info request.

Source

pub fn read_storage_key<T>(&self, key: &Key) -> Option<T>

Read the value for a storage key dropping any error

Source

pub fn read_storage_key_bytes(&self, key: &Key) -> Option<Vec<u8>>

Read the bytes for a storage key dropping any error

Source

pub fn get_validator_set_update_epoch(&self, current_epoch: Epoch) -> Epoch

Get the next epoch for which we can request validator set changed

Source

pub fn commit(&mut self) -> Response

Commit a block. Persist the application state and return the Merkle root hash.

Source

pub fn mempool_validate(&self, tx_bytes: &[u8], _type: MempoolTxType) -> CheckTx

Validate a transaction request. On success, the transaction will included in the mempool and propagated to peers, otherwise it will be rejected.

Source

pub fn get_current_decision_height(&self) -> BlockHeight

Retrieves the BlockHeight that is currently being decided.

Source

pub fn is_deciding_offset_within_epoch(&self, height_offset: u64) -> bool

Check if we are at a given BlockHeight offset, height_offset, within the current epoch.

Trait Implementations§

Source§

impl<D, H> Debug for Shell<D, H>
where D: DB + for<'iter> DBIter<'iter> + Sync + 'static + Debug, H: StorageHasher + Sync + 'static + Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D, H> Freeze for Shell<D, H>
where D: Freeze,

§

impl<D = RocksDB, H = Sha256Hasher> !RefUnwindSafe for Shell<D, H>

§

impl<D, H> Send for Shell<D, H>
where D: Send, H: Send,

§

impl<D, H> Sync for Shell<D, H>

§

impl<D, H> Unpin for Shell<D, H>
where D: Unpin, H: Unpin,

§

impl<D = RocksDB, H = Sha256Hasher> !UnwindSafe for Shell<D, H>

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
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> Conv for T

Source§

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

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

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

Source§

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

Deserializes using the given deserializer
Source§

impl<T> FmtForward for T

Source§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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> 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>

Gets the layout of the type.
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

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

Source§

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

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

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

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

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

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

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

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

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.
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 type for metadata in pointers and references to Self.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

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

Immutable access to a value. Read more
Source§

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

Mutable access to a value. Read more
Source§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Source§

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

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<T> Upcastable for T
where T: Any + Send + Sync + 'static,

Source§

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

upcast ref
Source§

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

upcast mut ref
Source§

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

upcast boxed dyn
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
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
Source§

impl<T, C> Convertible<C> for T
where T: TryFrom<C> + Into<C>,

Source§

impl<T> JsonSchemaMaybe for T

Source§

impl<T> MaybeArbitrary<'_> for T

Source§

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

Source§

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