clementine_core::database

Struct Database

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

PostgreSQL database connection details.

Implementations§

Source§

impl Database

Source

pub async fn set_signed_emergency_stop_tx( &self, tx: Option<DatabaseTransaction<'_, '_>>, move_txid: &Txid, emergency_stop_tx: &Transaction, ) -> Result<(), BridgeError>

Sets a signed emergency stop transaction for a given move transaction ID

Source

pub async fn get_emergency_stop_txs( &self, tx: Option<DatabaseTransaction<'_, '_>>, move_txids: Vec<Txid>, ) -> Result<Vec<(Txid, Transaction)>, BridgeError>

Gets emergency stop transactions for a list of move transaction IDs

Source§

impl Database

Source

pub async fn add_block_info( &self, tx: Option<DatabaseTransaction<'_, '_>>, block_hash: &BlockHash, prev_block_hash: &BlockHash, block_height: u32, ) -> Result<u32, BridgeError>

§Returns
  • u32: Database entry id, later to be used while referring block
Source

pub async fn set_block_as_canonical_if_exists( &self, tx: Option<DatabaseTransaction<'_, '_>>, block_hash: BlockHash, ) -> Result<Option<u32>, BridgeError>

Source

pub async fn get_block_info_from_hash( &self, tx: Option<DatabaseTransaction<'_, '_>>, block_hash: BlockHash, ) -> Result<Option<(BlockHash, u32)>, BridgeError>

§Returns

Some if the block exists in the database, None otherwise:

  • [BlockHash]: Previous block hash
  • u32: Height of the block
Source

pub async fn get_block_info_from_id( &self, tx: Option<DatabaseTransaction<'_, '_>>, block_id: u32, ) -> Result<Option<(BlockHash, u32)>, BridgeError>

Source

pub async fn store_full_block( &self, tx: Option<DatabaseTransaction<'_, '_>>, block: &Block, block_height: u32, ) -> Result<(), BridgeError>

Source

pub async fn get_full_block( &self, tx: Option<DatabaseTransaction<'_, '_>>, block_height: u32, ) -> Result<Option<Block>, BridgeError>

Source

pub async fn get_full_block_from_hash( &self, tx: Option<DatabaseTransaction<'_, '_>>, block_hash: BlockHash, ) -> Result<Option<(u32, Block)>, BridgeError>

Source

pub async fn get_max_height( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Option<u32>, BridgeError>

Source

pub async fn set_non_canonical_block_hashes( &self, tx: Option<DatabaseTransaction<'_, '_>>, height: u32, ) -> Result<Vec<u32>, BridgeError>

Gets the block hashes that have height bigger then the given height and deletes them.

Source

pub async fn get_canonical_block_id_from_height( &self, tx: Option<DatabaseTransaction<'_, '_>>, height: u32, ) -> Result<Option<u32>, BridgeError>

Source

pub async fn add_txid_to_block( &self, tx: DatabaseTransaction<'_, '_>, block_id: u32, txid: &Txid, ) -> Result<(), BridgeError>

Source

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

Source

pub async fn insert_spent_utxo( &self, tx: DatabaseTransaction<'_, '_>, block_id: u32, spending_txid: &Txid, txid: &Txid, vout: i64, ) -> Result<(), BridgeError>

Source

pub async fn get_spent_utxos_for_txid( &self, tx: Option<DatabaseTransaction<'_, '_>>, txid: Txid, ) -> Result<Vec<(i64, OutPoint)>, BridgeError>

Source

pub async fn add_event( &self, tx: Option<DatabaseTransaction<'_, '_>>, event_type: BitcoinSyncerEvent, ) -> Result<(), BridgeError>

Source

pub async fn fetch_next_bitcoin_syncer_evt( &self, tx: DatabaseTransaction<'_, '_>, consumer_handle: &str, ) -> Result<Option<BitcoinSyncerEvent>, BridgeError>

Source§

impl Database

Source

pub async fn save_unproven_finalized_block( &self, tx: Option<DatabaseTransaction<'_, '_>>, block_hash: BlockHash, block_header: Header, block_height: u64, ) -> Result<(), BridgeError>

Adds a new finalized block to the database, later to be updated with a proof.

Source

pub async fn fetch_and_save_missing_blocks( &self, rpc: &ExtendedRpc, genesis_height: u32, until_height: u32, ) -> Result<(), BridgeError>

This function assumes there are no blocks or some contiguous blocks starting from 0 already in the table. Saves the block hashes and headers until given height(exclusive) as they are needed for spv and hcp proofs.

Source

pub async fn get_block_info_from_range( &self, tx: Option<DatabaseTransaction<'_, '_>>, start_height: u64, end_height: u64, ) -> Result<Vec<(BlockHash, Header)>, BridgeError>

Returns block hash and header for a given range of heights. Ranges are inclusive on both ends.

Source

pub async fn get_block_info_from_hash_hcp( &self, tx: Option<DatabaseTransaction<'_, '_>>, block_hash: BlockHash, ) -> Result<Option<(BlockHash, Header, u32)>, BridgeError>

Returns the previous block hash and header for a given block hash.

§Returns

Returns None if the block hash is not found.

  • [BlockHash] - Previous block’s hash
  • [Header] - Block’s header
  • u32 - Block’s height
Source

pub async fn get_latest_finalized_block_height( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Option<u64>, BridgeError>

Returns latest finalized blocks height from the database.

Source

pub async fn get_next_unproven_block( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Option<(BlockHash, Header, u64, Receipt)>, BridgeError>

Gets the first finalized block after the latest proven block (i.e. proof != null). This block will be the candidate block for the prover.

§Returns

Returns None if either no proved blocks are exists or blockchain tip is already proven.

  • [BlockHash] - Hash of the block
  • [Header] - Header of the block
  • u64 - Height of the block
  • [Receipt] - Previous block’s proof
Source

pub async fn get_next_n_non_proven_block( &self, count: u32, ) -> Result<Option<(Vec<(BlockHash, Header, u64)>, Receipt)>, BridgeError>

Gets the newest n number of block’s info that their previous block has proven before. These blocks will be the candidate blocks for the prover.

§Returns

Returns None if either no proved blocks are exists or blockchain tip is already proven.

  • [BlockHash] - Hash of last block in the batch
  • [Header] - Headers of the blocks
  • u64 - Height of the last block in the batch
  • [Receipt] - Previous block’s proof
Source

pub async fn get_latest_proven_block_info( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Option<(BlockHash, Header, u64)>, BridgeError>

Gets the latest block’s info that it’s proven.

§Returns

Returns None if no block is proven.

  • [BlockHash] - Hash of the block
  • [Header] - Header of the block
  • u64 - Height of the block
Source

pub async fn get_latest_proven_block_info_until_height( &self, tx: Option<DatabaseTransaction<'_, '_>>, height: u32, ) -> Result<Option<(BlockHash, Header, u64)>, BridgeError>

Gets the latest block’s info that it’s proven and has height less than or equal to the given height.

§Returns

Returns None if no block is proven.

  • [BlockHash] - Hash of the block
  • [Header] - Header of the block
  • u64 - Height of the block
Source

pub async fn set_block_proof( &self, tx: Option<DatabaseTransaction<'_, '_>>, hash: BlockHash, proof: Receipt, ) -> Result<(), BridgeError>

Sets an existing block’s (in database) proof by referring to it by it’s hash.

Source

pub async fn get_block_proof_by_hash( &self, tx: Option<DatabaseTransaction<'_, '_>>, hash: BlockHash, ) -> Result<Option<Receipt>, BridgeError>

Gets a block’s proof by referring to it by it’s hash.

Source§

impl Database

Source

pub async fn set_operator( &self, tx: Option<DatabaseTransaction<'_, '_>>, xonly_pubkey: XOnlyPublicKey, wallet_address: &Address, collateral_funding_outpoint: OutPoint, ) -> Result<(), BridgeError>

Sets the operator details to the db. This function additionally checks if the operator data already exists in the db. As we don’t want to overwrite operator data on the db, as it can prevent us slash malicious operators that signed previous deposits. This function should give an error if an operator changed its data.

Source

pub async fn get_operators( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Vec<(XOnlyPublicKey, Address, OutPoint)>, BridgeError>

Source

pub async fn get_operator( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, ) -> Result<Option<OperatorData>, BridgeError>

Source

pub async fn set_funding_utxo( &self, tx: Option<DatabaseTransaction<'_, '_>>, funding_utxo: UTXO, ) -> Result<(), BridgeError>

Sets the funding UTXO for kickoffs.

Source

pub async fn get_funding_utxo( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Option<UTXO>, BridgeError>

Gets the funding UTXO for kickoffs

Source

pub async fn set_unspent_kickoff_sigs( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, round_idx: RoundIndex, signatures: Vec<TaggedSignature>, ) -> Result<(), BridgeError>

Sets the unspent kickoff sigs received from operators during initial setup. Sigs of each round are stored together in the same row. On conflict, do not update the existing sigs. Although technically, as long as kickoff winternitz keys and operator data(collateral funding outpoint and reimburse address) are not changed, the sigs are still valid even if they are changed.

Source

pub async fn get_unspent_kickoff_sigs( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, round_idx: RoundIndex, ) -> Result<Option<Vec<TaggedSignature>>, BridgeError>

Get unspent kickoff sigs for a specific operator and round.

Source

pub async fn set_operator_bitvm_keys( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, deposit_outpoint: OutPoint, winternitz_public_key: Vec<WinternitzPublicKey>, ) -> Result<(), BridgeError>

Sets Winternitz public keys for bitvm related inputs of an operator.

Source

pub async fn get_operator_bitvm_keys( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, deposit_outpoint: OutPoint, ) -> Result<Vec<PublicKey>, BridgeError>

Gets Winternitz public keys for bitvm related inputs of an operator.

Source

pub async fn set_operator_kickoff_winternitz_public_keys( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, winternitz_public_key: Vec<WinternitzPublicKey>, ) -> Result<(), BridgeError>

Sets Winternitz public keys (only for kickoff blockhash commit) for an operator. On conflict, do not update the existing keys. This is very important, as otherwise the txids of operators round tx’s will change.

Source

pub async fn get_operator_kickoff_winternitz_public_keys( &self, tx: Option<DatabaseTransaction<'_, '_>>, op_xonly_pk: XOnlyPublicKey, ) -> Result<Vec<PublicKey>, BridgeError>

Gets Winternitz public keys for every sequential collateral tx of an operator and a watchtower.

Source

pub async fn set_operator_challenge_ack_hashes( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, deposit_outpoint: OutPoint, public_hashes: &Vec<[u8; 20]>, ) -> Result<(), BridgeError>

Sets public hashes for a specific operator, sequential collateral tx and kickoff index combination. If there is hashes for given indexes, they will be overwritten by the new hashes.

Source

pub async fn get_operators_challenge_ack_hashes( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, deposit_outpoint: OutPoint, ) -> Result<Option<Vec<PublicHash>>, BridgeError>

Retrieves public hashes for a specific operator, sequential collateral tx and kickoff index combination.

Source

pub async fn set_deposit_data( &self, tx: Option<DatabaseTransaction<'_, '_>>, deposit_data: &mut DepositData, paramset: &'static ProtocolParamset, ) -> Result<u32, BridgeError>

Saves deposit infos, and returns the deposit_id This function additionally checks if the deposit data already exists in the db. As we don’t want to overwrite deposit data on the db, this function should give an error if deposit data is changed.

Source

pub async fn get_deposit_data_with_move_tx( &self, tx: Option<DatabaseTransaction<'_, '_>>, move_to_vault_txid: Txid, ) -> Result<Option<DepositData>, BridgeError>

Source

pub async fn get_deposit_data( &self, tx: Option<DatabaseTransaction<'_, '_>>, deposit_outpoint: OutPoint, ) -> Result<Option<(u32, DepositData)>, BridgeError>

Source

pub async fn set_deposit_signatures( &self, tx: Option<DatabaseTransaction<'_, '_>>, deposit_outpoint: OutPoint, operator_xonly_pk: XOnlyPublicKey, round_idx: RoundIndex, kickoff_idx: usize, kickoff_txid: Txid, signatures: Vec<TaggedSignature>, ) -> Result<(), BridgeError>

Saves the deposit signatures to the database for a single operator. The signatures array is identified by the deposit_outpoint and operator_idx. For the order of signatures, please check crate::builder::sighash::create_nofn_sighash_stream which determines the order of the sighashes that are signed.

Source

pub async fn get_deposit_id( &self, tx: Option<DatabaseTransaction<'_, '_>>, deposit_outpoint: OutPoint, ) -> Result<u32, BridgeError>

Gets a unique int for a deposit outpoint

Source

pub async fn get_deposit_signatures( &self, tx: Option<DatabaseTransaction<'_, '_>>, deposit_outpoint: OutPoint, operator_xonly_pk: XOnlyPublicKey, round_idx: RoundIndex, kickoff_idx: usize, ) -> Result<Option<Vec<TaggedSignature>>, BridgeError>

Retrieves the deposit signatures for a single operator for a single reimburse process (single kickoff utxo). The signatures are tagged so that each signature can be matched with the correct txin it belongs to easily.

Source

pub async fn get_deposit_data_with_kickoff_txid( &self, tx: Option<DatabaseTransaction<'_, '_>>, kickoff_txid: Txid, ) -> Result<Option<(DepositData, KickoffData)>, BridgeError>

Source

pub async fn set_bitvm_setup( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, deposit_outpoint: OutPoint, assert_tx_addrs: impl AsRef<[[u8; 32]]>, root_hash: &[u8; 32], latest_blockhash_root_hash: &[u8; 32], ) -> Result<(), BridgeError>

Sets BitVM setup data for a specific operator and deposit combination. This function additionally checks if the BitVM setup data already exists in the db. As we don’t want to overwrite BitVM setup data on the db, as maliciously overwriting can prevent us to regenerate previously signed kickoff tx’s.

Source

pub async fn get_bitvm_setup( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, deposit_outpoint: OutPoint, ) -> Result<Option<(Vec<[u8; 32]>, [u8; 32], [u8; 32])>, BridgeError>

Retrieves BitVM setup data for a specific operator, sequential collateral tx and kickoff index combination

Source

pub async fn set_kickoff_connector_as_used( &self, tx: Option<DatabaseTransaction<'_, '_>>, round_idx: RoundIndex, kickoff_connector_idx: u32, kickoff_txid: Option<Txid>, ) -> Result<(), BridgeError>

Source

pub async fn get_kickoff_txid_for_used_kickoff_connector( &self, tx: Option<DatabaseTransaction<'_, '_>>, round_idx: RoundIndex, kickoff_connector_idx: u32, ) -> Result<Option<Txid>, BridgeError>

Source

pub async fn get_unused_and_signed_kickoff_connector( &self, tx: Option<DatabaseTransaction<'_, '_>>, deposit_id: u32, operator_xonly_pk: XOnlyPublicKey, ) -> Result<Option<(u32, u32)>, BridgeError>

Source

pub async fn get_current_round_index( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Option<u32>, BridgeError>

Source

pub async fn update_current_round_index( &self, tx: Option<DatabaseTransaction<'_, '_>>, round_idx: RoundIndex, ) -> Result<(), BridgeError>

Source§

impl Database

Source

pub async fn get_last_deposit_idx( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Option<u32>, BridgeError>

Returns the last deposit index. If no deposits exist, returns None

Source

pub async fn get_last_withdrawal_idx( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<Option<u32>, BridgeError>

Returns the last withdrawal index where withdrawal_utxo_txid exists. If no withdrawals with UTXOs exist, returns None.

Source

pub async fn set_move_to_vault_txid_from_citrea_deposit( &self, tx: Option<DatabaseTransaction<'_, '_>>, citrea_idx: u32, move_to_vault_txid: &Txid, ) -> Result<(), BridgeError>

Source

pub async fn get_move_to_vault_txid_from_citrea_deposit( &self, tx: Option<DatabaseTransaction<'_, '_>>, citrea_idx: u32, ) -> Result<Option<Txid>, BridgeError>

Source

pub async fn set_replacement_deposit_move_txid( &self, tx: DatabaseTransaction<'_, '_>, idx: u32, new_move_txid: Txid, ) -> Result<(), BridgeError>

Source

pub async fn set_withdrawal_utxo_from_citrea_withdrawal( &self, tx: Option<DatabaseTransaction<'_, '_>>, citrea_idx: u32, withdrawal_utxo: OutPoint, withdrawal_batch_proof_bitcoin_block_height: u32, ) -> Result<(), BridgeError>

Source

pub async fn get_withdrawal_utxo_from_citrea_withdrawal( &self, tx: Option<DatabaseTransaction<'_, '_>>, citrea_idx: u32, ) -> Result<Option<OutPoint>, BridgeError>

Source

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

Returns the withdrawal indexes and their spending txid for the given block id.

Source

pub async fn set_payout_txs_and_payer_operator_xonly_pk( &self, tx: Option<DatabaseTransaction<'_, '_>>, payout_txs_and_payer_operator_xonly_pk: Vec<(u32, Txid, Option<XOnlyPublicKey>, BlockHash)>, ) -> Result<(), BridgeError>

Sets the given payout txs’ txid and operator index for the given index.

Source

pub async fn get_payout_info_from_move_txid( &self, tx: Option<DatabaseTransaction<'_, '_>>, move_to_vault_txid: Txid, ) -> Result<Option<(Option<XOnlyPublicKey>, BlockHash, Txid, i32)>, BridgeError>

Source

pub async fn get_first_unhandled_payout_by_operator_xonly_pk( &self, tx: Option<DatabaseTransaction<'_, '_>>, operator_xonly_pk: XOnlyPublicKey, ) -> Result<Option<(u32, Txid, BlockHash)>, BridgeError>

Source

pub async fn set_payout_handled( &self, tx: Option<DatabaseTransaction<'_, '_>>, citrea_idx: u32, kickoff_txid: Txid, ) -> Result<(), BridgeError>

Source

pub async fn get_handled_payout_kickoff_txid( &self, tx: Option<DatabaseTransaction<'_, '_>>, payout_txid: Txid, ) -> Result<Option<Txid>, BridgeError>

Source§

impl Database

Source

pub async fn new(config: &BridgeConfig) -> Result<Self, BridgeError>

Establishes a new connection to a PostgreSQL database with given configuration.

§Errors

Returns a BridgeError if database is not accessible.

Source

pub async fn close(&self)

Closes database connection.

Source

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

Source

pub async fn is_pgmq_installed( &self, tx: Option<DatabaseTransaction<'_, '_>>, ) -> Result<bool, BridgeError>

Source

pub async fn run_schema_script( config: &BridgeConfig, is_verifier: bool, ) -> Result<(), BridgeError>

Runs the schema script on a database for the given configuration.

§Errors

Will return BridgeError if there was a problem with database connection.

Source

pub fn get_postgresql_url(config: &BridgeConfig) -> String

Prepares a valid PostgreSQL URL.

URL contains user, password, host and port fields, which are picked from the given configuration.

Source

pub fn get_postgresql_database_url(config: &BridgeConfig) -> String

Prepares a valid PostgreSQL URL to a specific database.

URL contains user, password, host, port and database name fields, which are picked from the given configuration.

Source

pub async fn begin_transaction( &self, ) -> Result<Transaction<'_, Postgres>, BridgeError>

Starts a database transaction.

Return value can be used for committing changes. If not committed, database will rollback every operation done after that call.

Trait Implementations§

Source§

impl Clone for Database

Source§

fn clone(&self) -> Database

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 Database

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, dst: *mut u8)

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

impl<T> Conv for T

§

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

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

impl<T> Downcast for T
where T: Any,

§

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

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

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

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

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

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

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

§

fn exact_from(value: T) -> U

§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

§

fn exact_into(self) -> U

§

impl<T> FmtForward for T

§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

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

impl<T> Instrument for T

§

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

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

fn in_current_span(self) -> Instrumented<Self>

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

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

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

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

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

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

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

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

impl<T, U> OverflowingInto<U> for T
where U: OverflowingFrom<T>,

§

fn overflowing_into(self) -> (U, bool)

§

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

§

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> 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
§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

§

fn rounding_into(self, rm: RoundingMode) -> (U, Ordering)

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

§

fn saturating_into(self) -> U

§

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

impl<T> ToDebugString for T
where T: Debug,

§

fn to_debug_string(&self) -> String

Returns the String produced by Ts Debug implementation.

§Examples
use malachite_base::strings::ToDebugString;

assert_eq!([1, 2, 3].to_debug_string(), "[1, 2, 3]");
assert_eq!(
    [vec![2, 3], vec![], vec![4]].to_debug_string(),
    "[[2, 3], [], [4]]"
);
assert_eq!(Some(5).to_debug_string(), "Some(5)");
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, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

§

fn wrapping_into(self) -> U

§

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

§

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