Struct TxSenderDb

Source
pub struct TxSenderDb {
    pool: Pool<Postgres>,
}
Expand description

A thin Postgres wrapper dedicated to tx-sender tables.

Fields§

§pool: Pool<Postgres>

Implementations§

Source§

impl TxSenderDb

Source

pub async fn insert_citrea_raw_tx_single( &self, tx: TxSenderDbTx<'_>, transaction_kind: TransactionKind, body: &[u8], ) -> Result<i64, BridgeError>

Inserts a single non-chunked Citrea raw tx row. Uses the row body itself as the body_hash dedupe input. Returns the insertion_id assigned to this row.

Source

pub(crate) async fn insert_citrea_raw_tx_single_with_hash( &self, tx: TxSenderDbTx<'_>, transaction_kind: TransactionKind, body: &[u8], body_hash: &[u8], ) -> Result<i64, BridgeError>

Inserts a single Citrea raw tx row using an explicit body_hash.

This is used for BatchProof so Complete and chunked encodings of the same proof share one dedupe key, even though the stored row body differs. Returns the insertion_id assigned to this row.

Source

async fn insert_citrea_raw_tx_with_hash_status( &self, tx: TxSenderDbTx<'_>, transaction_kind: TransactionKind, body: Option<&[u8]>, body_hash: &[u8], ) -> Result<(i64, bool), BridgeError>

Inserts a Citrea raw tx row and returns whether it was newly inserted.

body_hash is the unique dedupe key. It usually hashes this row’s body, but callers may pass the hash of a larger logical payload when several rows represent one request. If the body hash already exists, returns the existing insertion_id with inserted = false.

Source

pub async fn set_citrea_commit_outpoint( &self, tx: Option<TxSenderDbTx<'_>>, id: i64, outpoint: OutPoint, ) -> Result<(), BridgeError>

Sets the commit outpoint for a specific Citrea raw tx row.

Source

pub async fn insert_citrea_raw_tx_chunks( &self, tx: TxSenderDbTx<'_>, chunks: &[Vec<u8>], full_body_hash: &[u8], ) -> Result<i64, BridgeError>

Inserts chunked Citrea raw tx data: N chunk rows + 1 aggregate row. All rows share the same insertion_id.

The aggregate placeholder carries full_body_hash as the dedupe key for the original proof. Chunk rows intentionally keep body_hash NULL; we do not dedupe individual chunks against unrelated requests. Returns the insertion_id assigned to this group.

Source

pub async fn get_citrea_txs_with_null_commit_outpoint( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<CitreaRawTxRow>, BridgeError>

Returns non-aggregate citrea transactions with null commit_outpoint. Excludes aggregate transactions (transaction_kind = 1).

Source

pub async fn get_citrea_txs_with_commit_outpoint_no_try_to_send( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<CitreaRawTxRow>, BridgeError>

Returns non-aggregate citrea transactions with commit_outpoint but no try_to_send_id. Excludes aggregate transactions (transaction_kind = 1).

Source

pub async fn get_citrea_txs_with_commit_outpoint( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<CitreaRawTxRow>, BridgeError>

Returns citrea transactions with commit_outpoint (regardless of try_to_send_id).

Source

pub async fn get_citrea_txs_with_commit_outpoint_unseen_try_to_send( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<CitreaRawTxRow>, BridgeError>

Returns Citrea transactions with commit_outpoint where try_to_send_id is NULL or the try-to-send tx has not been seen yet.

Source

pub async fn clear_citrea_commit_and_try_to_send_by_ids( &self, tx: Option<TxSenderDbTx<'_>>, ids: &[i64], ) -> Result<(), BridgeError>

Clears commit_outpoint and try_to_send_id for specific Citrea rows.

Source

pub async fn set_citrea_try_to_send_id( &self, tx: TxSenderDbTx<'_>, id: i64, try_to_send_id: i32, ) -> Result<(), BridgeError>

Sets the try_to_send_id for a specific Citrea raw tx row.

Source

pub async fn get_citrea_aggregate_rows_pending( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<CitreaRawTxRow>, BridgeError>

Returns aggregate placeholder rows that are not finalized.

Source

pub async fn get_citrea_chunk_rows_by_insertion_id( &self, tx: Option<TxSenderDbTx<'_>>, insertion_id: i64, ) -> Result<Vec<CitreaRawTxRow>, BridgeError>

Returns chunk rows for a given insertion_id, ordered by row id.

Source

pub async fn update_citrea_aggregate_body_and_reset( &self, tx: Option<TxSenderDbTx<'_>>, id: i64, body: &[u8], ) -> Result<(), BridgeError>

Updates the body for an aggregate Citrea row, resetting commit/try_to_send state.

The body_hash remains the original full proof hash rather than being recomputed from the aggregate body, so repeated BatchProof submissions still dedupe to this insertion group.

Source

pub async fn set_citrea_aggregate_finalized( &self, tx: Option<TxSenderDbTx<'_>>, id: i64, ) -> Result<(), BridgeError>

Marks an aggregate row as finalized.

Source§

impl TxSenderDb

Source

pub async fn save_fee_payer_tx( &self, tx: Option<TxSenderDbTx<'_>>, bumped_id: u32, fee_payer_txid: Txid, vout: u32, amount: Amount, replacement_of_id: Option<u32>, ) -> Result<(), BridgeError>

Saves a fee payer transaction to the database.

§Arguments
  • bumped_id - The id of the transaction funded by this fee payer.
  • fee_payer_txid - The txid of the fee payer transaction.
  • vout - The output index of the fee payer UTXO.
  • amount - The amount in satoshis.
  • replacement_of_id - The fee payer UTXO this row replaces, if any.
Source

pub async fn get_all_unconfirmed_fee_payer_txs( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<(u32, u32, Txid, u32, Amount, Option<u32>)>, BridgeError>

Returns all unconfirmed fee payer UTXOs.

UTXOs whose replacement chain already has a confirmed member are excluded. If no replacement in the chain is confirmed, all unconfirmed replacements are returned.

§Returns

A vector of fee payer UTXO details:

  • u32: id of the fee payer UTXO row.
  • u32: id of the bumped transaction.
  • [Txid]: txid of the fee payer transaction.
  • u32: output index of the UTXO.
  • [Amount]: amount in satoshis.
  • Option<u32>: replaced fee payer UTXO id, if this is a replacement.
Source

pub async fn get_unconfirmed_fee_payer_txs( &self, tx: Option<TxSenderDbTx<'_>>, bumped_id: u32, ) -> Result<Vec<(u32, Txid, u32, Amount)>, BridgeError>

Returns unconfirmed fee payer UTXOs for one try-to-send transaction.

UTXOs whose replacement chain already has a confirmed member are excluded. If no replacement in the chain is confirmed, all unconfirmed replacements are returned.

§Arguments
  • bumped_id - The id of the transaction funded by the fee payer UTXOs.
§Returns

A vector of fee payer UTXO details:

  • u32: id of the fee payer UTXO row.
  • [Txid]: txid of the fee payer transaction.
  • u32: output index of the UTXO.
  • [Amount]: amount in satoshis.
Source

pub async fn mark_fee_payer_utxo_as_evicted( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, ) -> Result<(), BridgeError>

Marks a fee payer UTXO and all of its replacements as evicted.

Evicted fee payer UTXOs are no longer selected for bumps, because their wallet inputs may already have been reused elsewhere.

Source

pub async fn get_confirmed_fee_payer_utxos( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, ) -> Result<Vec<(Txid, u32, Amount)>, BridgeError>

Source

pub async fn check_if_tx_exists_on_txsender( &self, tx: Option<TxSenderDbTx<'_>>, txid: Txid, ) -> Result<Option<u32>, BridgeError>

Returns the tx-sender row id for txid if it already exists.

This is used before inserting to avoid adding duplicate transactions to the queue.

Source

pub async fn save_tx( &self, tx: TxSenderDbTx<'_>, tx_metadata: Option<TxMetadata>, raw_tx: &Transaction, fee_paying_type: FeePayingType, txid: Txid, rbf_signing_info: Option<RbfSigningInfo>, ) -> Result<u32, BridgeError>

Source

pub async fn save_rbf_txid( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, txid: Txid, ) -> Result<(), BridgeError>

Source

pub async fn get_last_rbf_txid( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, ) -> Result<Option<Txid>, BridgeError>

Source

pub async fn list_rbf_txids_for_id( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, ) -> Result<Vec<Txid>, BridgeError>

Source

pub async fn save_cancelled_outpoint( &self, tx: TxSenderDbTx<'_>, cancelled_id: u32, outpoint: OutPoint, ) -> Result<(), BridgeError>

Source

pub async fn save_cancelled_txid( &self, tx: TxSenderDbTx<'_>, cancelled_id: u32, txid: Txid, ) -> Result<(), BridgeError>

Source

pub async fn save_activated_txid( &self, tx: TxSenderDbTx<'_>, activated_id: u32, prerequisite_tx: &ActivatedWithTxid, ) -> Result<(), BridgeError>

Source

pub async fn save_activated_outpoint( &self, tx: TxSenderDbTx<'_>, activated_id: u32, activated_outpoint: &ActivatedWithOutpoint, ) -> Result<(), BridgeError>

Source

pub async fn get_sendable_txs( &self, tx: Option<TxSenderDbTx<'_>>, fee_rate: FeeRateKvb, current_tip_height: u32, ) -> Result<Vec<u32>, BridgeError>

Returns unconfirmed try-to-send transactions that satisfy all queue conditions.

A transaction is sendable when:

  • all activation dependencies have been seen and their relative block timelocks passed;
  • zero-timelock txid activations are either seen on-chain or currently in mempool;
  • no cancellation dependency has been seen;
  • the transaction itself has not been seen on-chain;
  • its previous effective fee rate is lower than fee_rate, or it has never been sent.

Passing a very high fee_rate is used by callers to retrieve all active transactions after a new block, even when the market fee did not increase.

§Returns

A vector of tx-sender database ids that are ready to send or bump.

Source

pub async fn get_effective_fee_rate( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, ) -> Result<(Option<FeeRateKvb>, Option<u32>), BridgeError>

Returns the effective fee rate and block height from the last actual fee bump.

Returns (None, None) if no effective fee rate has been recorded yet.

Source

pub async fn update_effective_fee_rate( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, effective_fee_rate: FeeRateKvb, block_height: u32, ) -> Result<(), BridgeError>

Updates the effective fee rate and last bump block height for a transaction.

The row is updated only when the fee rate changes, or when the previous fee rate is NULL. This preserves last_bump_block_height across retries at the same fee rate, so the stuck-for-N-blocks counter continues from the last real bump.

effective_fee_rate is stored in sat/kvB.

Source

pub async fn get_try_to_send_tx( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, ) -> Result<(Option<TxMetadata>, Transaction, FeePayingType, Option<u32>, Option<RbfSigningInfo>), BridgeError>

Source

pub async fn save_tx_debug_submission_error( &self, tx: Option<TxSenderDbTx<'_>>, tx_id: u32, error_message: &str, ) -> Result<(), BridgeError>

Saves a transaction submission error to the debug table.

Source

pub async fn update_tx_debug_sending_state( &self, tx_id: u32, state: &str, activated: bool, ) -> Result<(), BridgeError>

Updates or inserts the transaction’s current debug sending state.

This intentionally does not accept a database transaction. It is debug-only metadata and callers should use it after the tx-sender row has been committed.

Source

pub async fn get_tx_debug_info( &self, tx: Option<TxSenderDbTx<'_>>, tx_id: u32, ) -> Result<Option<String>, BridgeError>

Returns the current debug sending state for a transaction.

Source

pub async fn get_tx_debug_submission_errors( &self, tx: Option<TxSenderDbTx<'_>>, tx_id: u32, ) -> Result<Vec<(String, String)>, BridgeError>

Returns all recorded submission errors for a transaction, ordered by timestamp.

Source

pub async fn get_tx_debug_fee_payer_utxos( &self, tx: Option<TxSenderDbTx<'_>>, tx_id: u32, ) -> Result<Vec<(Txid, u32, Amount, bool)>, BridgeError>

Returns all fee payer UTXOs for a transaction with their confirmation status.

Source

pub async fn debug_inactive_txs( &self, fee_rate: FeeRateKvb, current_tip_height: u32, )

Debug-only helper: log why some txs are inactive (not sendable).

Source

pub async fn list_unfinalized_try_to_send_txs( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<(u32, FeePayingType, Txid, Option<u32>)>, BridgeError>

Lists all unfinalized try-to-send transactions that should be checked for confirmation.

This function excludes transactions that have been permanently cancelled (i.e., any cancellation from tx_sender_cancel_try_to_send_txids or tx_sender_cancel_try_to_send_outpoints is finalized). Once a cancellation is finalized, the transaction can never be sent, so there’s no point in repeatedly checking it via RPC. This prevents unnecessary RPC calls for transactions that are permanently cancelled.

Source

pub async fn list_rbf_txids_for_ids( &self, tx: Option<TxSenderDbTx<'_>>, ids: &[u32], ) -> Result<Vec<(u32, Txid)>, BridgeError>

Source

pub async fn set_try_to_send_seen_at_height( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, seen_at_height: Option<u32>, ) -> Result<(), BridgeError>

Source

pub async fn list_try_to_send_statuses_by_ids( &self, tx: Option<TxSenderDbTx<'_>>, ids: &[u32], ) -> Result<HashMap<u32, (Option<u32>, bool)>, BridgeError>

Returns seen_at_height and is_finalized for a set of try_to_send ids.

Source

pub async fn set_try_to_send_finalized( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, is_finalized: bool, ) -> Result<(), BridgeError>

Source

pub async fn list_unfinalized_fee_payer_utxos( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<(u32, Txid, Option<u32>)>, BridgeError>

Lists all unfinalized fee payer UTXOs that should be checked for confirmation.

Fee payer UTXOs form replacement chains via replacement_of_id:

  • The first created UTXO in a chain has replacement_of_id IS NULL and its id is the canonical parent id for the chain.
  • All replacements in that chain have replacement_of_id = <parent id>.

This function excludes fee payer UTXOs where any UTXO in the same replacement chain (canonical parent or any of its replacements) is already finalized. Once a chain has a finalized fee payer UTXO, there’s no need to check the others, preventing unnecessary RPC calls.

Source

pub async fn set_fee_payer_seen_at_height( &self, tx: Option<TxSenderDbTx<'_>>, fee_payer_utxo_id: u32, seen_at_height: Option<u32>, ) -> Result<(), BridgeError>

Source

pub async fn set_fee_payer_finalized( &self, tx: Option<TxSenderDbTx<'_>>, fee_payer_utxo_id: u32, is_finalized: bool, ) -> Result<(), BridgeError>

Source

pub async fn list_unfinalized_cancel_txids( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<(u32, Txid, Option<u32>)>, BridgeError>

Source

pub async fn set_cancel_txid_seen_at_height( &self, tx: Option<TxSenderDbTx<'_>>, cancelled_id: u32, txid: Txid, seen_at_height: Option<u32>, ) -> Result<(), BridgeError>

Source

pub async fn set_cancel_txid_finalized( &self, tx: Option<TxSenderDbTx<'_>>, cancelled_id: u32, txid: Txid, is_finalized: bool, ) -> Result<(), BridgeError>

Source

pub async fn list_unfinalized_activate_txids( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<(u32, Txid, Option<u32>, bool)>, BridgeError>

Source

pub async fn set_activate_txid_seen_at_height( &self, tx: Option<TxSenderDbTx<'_>>, activated_id: u32, txid: Txid, seen_at_height: Option<u32>, ) -> Result<(), BridgeError>

Source

pub async fn set_activate_txid_finalized( &self, tx: Option<TxSenderDbTx<'_>>, activated_id: u32, txid: Txid, is_finalized: bool, ) -> Result<(), BridgeError>

Source

pub async fn set_activate_txid_mempool_status( &self, tx: Option<TxSenderDbTx<'_>>, activated_id: u32, txid: Txid, in_mempool: bool, ) -> Result<(), BridgeError>

Source

pub async fn get_activate_txid_status( &self, tx: Option<TxSenderDbTx<'_>>, txid: Txid, ) -> Result<Option<(bool, Option<u32>)>, BridgeError>

Source

pub async fn delete_try_to_send_tx( &self, tx: Option<TxSenderDbTx<'_>>, id: u32, ) -> Result<(), BridgeError>

Source

pub async fn list_unfinalized_cancel_outpoints( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<(u32, OutPoint, Option<u32>)>, BridgeError>

Source

pub async fn set_cancel_outpoint_seen_at_height( &self, tx: Option<TxSenderDbTx<'_>>, cancelled_id: u32, outpoint: OutPoint, seen_at_height: Option<u32>, ) -> Result<(), BridgeError>

Source

pub async fn set_cancel_outpoint_finalized( &self, tx: Option<TxSenderDbTx<'_>>, cancelled_id: u32, outpoint: OutPoint, is_finalized: bool, ) -> Result<(), BridgeError>

Source

pub async fn list_unfinalized_activate_outpoints( &self, tx: Option<TxSenderDbTx<'_>>, ) -> Result<Vec<(u32, OutPoint, Option<u32>)>, BridgeError>

Source

pub async fn set_activate_outpoint_seen_at_height( &self, tx: Option<TxSenderDbTx<'_>>, activated_id: u32, outpoint: OutPoint, seen_at_height: Option<u32>, ) -> Result<(), BridgeError>

Source

pub async fn set_activate_outpoint_finalized( &self, tx: Option<TxSenderDbTx<'_>>, activated_id: u32, outpoint: OutPoint, is_finalized: bool, ) -> Result<(), BridgeError>

Source

pub async fn update_synced_height(&self, height: u32) -> Result<(), BridgeError>

Source

pub async fn get_synced_height(&self) -> Result<Option<u32>, BridgeError>

Source§

impl TxSenderDb

Source

pub fn from_pool(pool: Pool<Postgres>) -> Self

Source

pub fn pool(&self) -> &Pool<Postgres>

Source

pub async fn connect(cfg: &TxSenderPostgresConfig) -> Result<Self, BridgeError>

Source

pub async fn begin_transaction( &self, ) -> Result<TxSenderTransaction, BridgeError>

Source

pub async fn commit_transaction( &self, tx: TxSenderTransaction, ) -> Result<(), BridgeError>

Source

pub async fn run_migrations(&self) -> Result<(), BridgeError>

Runs tx-sender schema initialization/migrations.

Trait Implementations§

Source§

impl Clone for TxSenderDb

Source§

fn clone(&self) -> TxSenderDb

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TxSenderDb

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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
§

impl<T> Conv for T

§

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

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

impl<T> FmtForward for T

§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

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

impl<T> Instrument for T

§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

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

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

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

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

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

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

impl<D> OwoColorize for D

§

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

Set the foreground color generically Read more
§

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

Set the background color generically. Read more
§

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

Change the foreground color to black
§

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

Change the background color to black
§

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

Change the foreground color to red
§

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

Change the background color to red
§

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

Change the foreground color to green
§

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

Change the background color to green
§

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

Change the foreground color to yellow
§

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

Change the background color to yellow
§

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

Change the foreground color to blue
§

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

Change the background color to blue
§

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

Change the foreground color to magenta
§

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

Change the background color to magenta
§

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

Change the foreground color to purple
§

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

Change the background color to purple
§

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

Change the foreground color to cyan
§

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

Change the background color to cyan
§

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

Change the foreground color to white
§

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

Change the background color to white
§

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

Change the foreground color to the terminal default
§

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

Change the background color to the terminal default
§

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

Change the foreground color to bright black
§

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

Change the background color to bright black
§

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

Change the foreground color to bright red
§

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

Change the background color to bright red
§

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

Change the foreground color to bright green
§

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

Change the background color to bright green
§

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

Change the foreground color to bright yellow
§

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

Change the background color to bright yellow
§

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

Change the foreground color to bright blue
§

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

Change the background color to bright blue
§

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

Change the foreground color to bright magenta
§

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

Change the background color to bright magenta
§

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

Change the foreground color to bright purple
§

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

Change the background color to bright purple
§

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

Change the foreground color to bright cyan
§

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

Change the background color to bright cyan
§

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

Change the foreground color to bright white
§

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

Change the background color to bright white
§

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

Make the text bold
§

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

Make the text dim
§

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

Make the text italicized
§

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

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

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

Swap the foreground and background colors
§

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

Hide the text
§

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

Cross out the text
§

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
§

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
§

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

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

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

Sets the foreground color to an RGB value.
§

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

Sets the background color to an RGB value.
§

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

Apply a runtime-determined style
§

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

§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

§

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
§

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
§

impl<T> Tap for T

§

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

Immutable access to a value. Read more
§

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

Mutable access to a value. Read more
§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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
§

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

§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
§

impl<T> TryConv for T

§

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

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

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

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

impl<T> MaybeSend for T
where T: Send,