Enum Transaction

Source
pub enum Transaction {
    V1 {
        inputs: Vec<Input>,
        outputs: Vec<Output>,
        lock_time: LockTime,
    },
    V2 {
        inputs: Vec<Input>,
        outputs: Vec<Output>,
        lock_time: LockTime,
        joinsplit_data: Option<JoinSplitData<Bctv14Proof>>,
    },
    V3 {
        inputs: Vec<Input>,
        outputs: Vec<Output>,
        lock_time: LockTime,
        expiry_height: Height,
        joinsplit_data: Option<JoinSplitData<Bctv14Proof>>,
    },
    V4 {
        inputs: Vec<Input>,
        outputs: Vec<Output>,
        lock_time: LockTime,
        expiry_height: Height,
        joinsplit_data: Option<JoinSplitData<Groth16Proof>>,
        sapling_shielded_data: Option<ShieldedData<PerSpendAnchor>>,
    },
    V5 {
        network_upgrade: NetworkUpgrade,
        lock_time: LockTime,
        expiry_height: Height,
        inputs: Vec<Input>,
        outputs: Vec<Output>,
        sapling_shielded_data: Option<ShieldedData<SharedAnchor>>,
        orchard_shielded_data: Option<ShieldedData>,
    },
}
Expand description

A Zcash transaction.

A transaction is an encoded data structure that facilitates the transfer of value between two public key addresses on the Zcash ecosystem. Everything is designed to ensure that transactions can be created, propagated on the network, validated, and finally added to the global ledger of transactions (the blockchain).

Zcash has a number of different transaction formats. They are represented internally by different enum variants. Because we checkpoint on Canopy activation, we do not validate any pre-Sapling transaction types.

Variants§

§

V1

A fully transparent transaction (version = 1).

Fields

§inputs: Vec<Input>

The transparent inputs to the transaction.

§outputs: Vec<Output>

The transparent outputs from the transaction.

§lock_time: LockTime

The earliest time or block height that this transaction can be added to the chain.

§

V2

A Sprout transaction (version = 2).

Fields

§inputs: Vec<Input>

The transparent inputs to the transaction.

§outputs: Vec<Output>

The transparent outputs from the transaction.

§lock_time: LockTime

The earliest time or block height that this transaction can be added to the chain.

§joinsplit_data: Option<JoinSplitData<Bctv14Proof>>

The JoinSplit data for this transaction, if any.

§

V3

An Overwinter transaction (version = 3).

Fields

§inputs: Vec<Input>

The transparent inputs to the transaction.

§outputs: Vec<Output>

The transparent outputs from the transaction.

§lock_time: LockTime

The earliest time or block height that this transaction can be added to the chain.

§expiry_height: Height

The latest block height that this transaction can be added to the chain.

§joinsplit_data: Option<JoinSplitData<Bctv14Proof>>

The JoinSplit data for this transaction, if any.

§

V4

A Sapling transaction (version = 4).

Fields

§inputs: Vec<Input>

The transparent inputs to the transaction.

§outputs: Vec<Output>

The transparent outputs from the transaction.

§lock_time: LockTime

The earliest time or block height that this transaction can be added to the chain.

§expiry_height: Height

The latest block height that this transaction can be added to the chain.

§joinsplit_data: Option<JoinSplitData<Groth16Proof>>

The JoinSplit data for this transaction, if any.

§sapling_shielded_data: Option<ShieldedData<PerSpendAnchor>>

The sapling shielded data for this transaction, if any.

§

V5

A version = 5 transaction , which supports Orchard, Sapling, and transparent, but not Sprout.

Fields

§network_upgrade: NetworkUpgrade

The Network Upgrade for this transaction.

Derived from the ConsensusBranchId field.

§lock_time: LockTime

The earliest time or block height that this transaction can be added to the chain.

§expiry_height: Height

The latest block height that this transaction can be added to the chain.

§inputs: Vec<Input>

The transparent inputs to the transaction.

§outputs: Vec<Output>

The transparent outputs from the transaction.

§sapling_shielded_data: Option<ShieldedData<SharedAnchor>>

The sapling shielded data for this transaction, if any.

§orchard_shielded_data: Option<ShieldedData>

The orchard data for this transaction, if any.

Implementations§

Source§

impl Transaction

Source

pub fn new_v5_coinbase( network: &Network, height: Height, outputs: impl IntoIterator<Item = (Amount<NonNegative>, Script)>, miner_data: Vec<u8>, ) -> Transaction

Returns a new version 5 coinbase transaction for network and height, which contains the specified outputs.

Source

pub fn new_v4_coinbase( height: Height, outputs: impl IntoIterator<Item = (Amount<NonNegative>, Script)>, miner_data: Vec<u8>, ) -> Transaction

Returns a new version 4 coinbase transaction for network and height, which contains the specified outputs.

If like_zcashd is true, try to match the coinbase transactions generated by zcashd in the getblocktemplate RPC.

Source§

impl Transaction

Source

pub fn hash(&self) -> Hash

Compute the hash (mined transaction ID) of this transaction.

The hash uniquely identifies mined v5 transactions, and all v1-v4 transactions, whether mined or unmined.

Source

pub fn unmined_id(&self) -> UnminedTxId

Compute the unmined transaction ID of this transaction.

This ID uniquely identifies unmined transactions, regardless of version.

Source

pub fn sighash( &self, nu: NetworkUpgrade, hash_type: HashType, all_previous_outputs: Arc<Vec<Output>>, input_index_script_code: Option<(usize, Vec<u8>)>, ) -> Result<SigHash, Error>

Calculate the sighash for the current transaction.

If you need to compute multiple sighashes for the same transactions, it’s more efficient to use Transaction::sighasher().

§Details

all_previous_outputs represents the UTXOs being spent by each input in the transaction.

The input_index_script_code tuple indicates the index of the transparent Input for which we are producing a sighash and the respective script code being validated, or None if it’s a shielded input.

§Panics
  • if passed in any NetworkUpgrade from before NetworkUpgrade::Overwinter
  • if called on a v1 or v2 transaction
  • if the input index points to a transparent::Input::CoinBase
  • if the input index is out of bounds for self.inputs()
  • if the tx contains nConsensusBranchId field and nu doesn’t match it
  • if the tx is not convertible to its librustzcash equivalent
  • if nu doesn’t contain a consensus branch id convertible to its librustzcash equivalent
Source

pub fn sighasher( &self, nu: NetworkUpgrade, all_previous_outputs: Arc<Vec<Output>>, ) -> Result<SigHasher, Error>

Return a SigHasher for this transaction.

Source

pub fn auth_digest(&self) -> Option<AuthDigest>

Compute the authorizing data commitment of this transaction as specified in ZIP-244.

Returns None for pre-v5 transactions.

Source

pub fn has_transparent_inputs(&self) -> bool

Does this transaction have transparent inputs?

Source

pub fn has_transparent_outputs(&self) -> bool

Does this transaction have transparent outputs?

Source

pub fn has_transparent_inputs_or_outputs(&self) -> bool

Does this transaction have transparent inputs or outputs?

Source

pub fn has_transparent_or_shielded_inputs(&self) -> bool

Does this transaction have transparent or shielded inputs?

Source

pub fn has_shielded_inputs(&self) -> bool

Does this transaction have shielded inputs?

See Self::has_transparent_or_shielded_inputs for details.

Source

pub fn has_shielded_outputs(&self) -> bool

Does this transaction have shielded outputs?

See Self::has_transparent_or_shielded_outputs for details.

Source

pub fn has_transparent_or_shielded_outputs(&self) -> bool

Does this transaction have transparent or shielded outputs?

Source

pub fn has_enough_orchard_flags(&self) -> bool

Does this transaction has at least one flag when we have at least one orchard action?

Source

pub fn coinbase_spend_restriction( &self, network: &Network, spend_height: Height, ) -> CoinbaseSpendRestriction

Returns the CoinbaseSpendRestriction for this transaction, assuming it is mined at spend_height.

Source

pub fn is_overwintered(&self) -> bool

Return if the fOverwintered flag of this transaction is set.

Source

pub fn version(&self) -> u32

Returns the version of this transaction.

Note that the returned version is equal to effectiveVersion, described in § 7.1 Transaction Encoding and Consensus:

effectiveVersion […] is equal to min(2, version) when fOverwintered = 0 and to version otherwise.

Zebra handles the fOverwintered flag via the Self::is_overwintered method.

Source

pub fn lock_time(&self) -> Option<LockTime>

Get this transaction’s lock time.

Source

pub fn raw_lock_time(&self) -> u32

Get the raw lock time value.

Source

pub fn lock_time_is_time(&self) -> bool

Returns true if this transaction’s lock_time is a LockTime::Time. Returns false if it is a LockTime::Height (locked or unlocked), is unlocked, or if the transparent input sequence numbers have disabled lock times.

Source

pub fn expiry_height(&self) -> Option<Height>

Get this transaction’s expiry height, if any.

Source

pub fn network_upgrade(&self) -> Option<NetworkUpgrade>

Get this transaction’s network upgrade field, if any. This field is serialized as nConsensusBranchId (7.1).

Source

pub fn inputs(&self) -> &[Input]

Access the transparent inputs of this transaction, regardless of version.

Source

pub fn spent_outpoints(&self) -> impl Iterator<Item = OutPoint> + '_

Access the transparent::OutPoints spent by this transaction’s transparent::Inputs.

Source

pub fn outputs(&self) -> &[Output]

Access the transparent outputs of this transaction, regardless of version.

Source

pub fn is_coinbase(&self) -> bool

Returns true if this transaction has valid inputs for a coinbase transaction, that is, has a single input and it is a coinbase input (null prevout).

Source

pub fn is_valid_non_coinbase(&self) -> bool

Returns true if this transaction has valid inputs for a non-coinbase transaction, that is, does not have any coinbase input (non-null prevouts).

Note that it’s possible for a transaction return false in both Transaction::is_coinbase and Transaction::is_valid_non_coinbase, though those transactions will be rejected.

Source

pub fn sprout_groth16_joinsplits( &self, ) -> Box<dyn Iterator<Item = &JoinSplit<Groth16Proof>> + '_>

Returns the Sprout JoinSplit<Groth16Proof>s in this transaction, regardless of version.

Source

pub fn joinsplit_count(&self) -> usize

Returns the number of JoinSplits in this transaction, regardless of version.

Source

pub fn sprout_nullifiers(&self) -> Box<dyn Iterator<Item = &Nullifier> + '_>

Access the sprout::Nullifiers in this transaction, regardless of version.

Source

pub fn sprout_joinsplit_pub_key(&self) -> Option<VerificationKeyBytes>

Access the JoinSplit public validating key in this transaction, regardless of version, if any.

Source

pub fn has_sprout_joinsplit_data(&self) -> bool

Return if the transaction has any Sprout JoinSplit data.

Source

pub fn sprout_note_commitments( &self, ) -> Box<dyn Iterator<Item = &NoteCommitment> + '_>

Returns the Sprout note commitments in this transaction.

Source

pub fn sapling_anchors(&self) -> Box<dyn Iterator<Item = Root> + '_>

Access the deduplicated sapling::tree::Roots in this transaction, regardless of version.

Source

pub fn sapling_spends_per_anchor( &self, ) -> Box<dyn Iterator<Item = Spend<PerSpendAnchor>> + '_>

Iterate over the sapling Spends for this transaction, returning Spend<PerSpendAnchor> regardless of the underlying transaction version.

Shared anchors in V5 transactions are copied into each sapling spend. This allows the same code to validate spends from V4 and V5 transactions.

§Correctness

Do not use this function for serialization.

Source

pub fn sapling_outputs(&self) -> Box<dyn Iterator<Item = &Output> + '_>

Iterate over the sapling Outputs for this transaction

Source

pub fn sapling_nullifiers(&self) -> Box<dyn Iterator<Item = &Nullifier> + '_>

Access the sapling::Nullifiers in this transaction, regardless of version.

Source

pub fn sapling_note_commitments(&self) -> Box<dyn Iterator<Item = &Fq> + '_>

Returns the Sapling note commitments in this transaction, regardless of version.

Source

pub fn has_sapling_shielded_data(&self) -> bool

Return if the transaction has any Sapling shielded data.

Source

pub fn orchard_shielded_data(&self) -> Option<&ShieldedData>

Access the orchard::ShieldedData in this transaction, regardless of version.

Source

pub fn orchard_actions(&self) -> impl Iterator<Item = &Action>

Iterate over the orchard::Actions in this transaction, if there are any, regardless of version.

Source

pub fn orchard_nullifiers(&self) -> impl Iterator<Item = &Nullifier>

Access the orchard::Nullifiers in this transaction, if there are any, regardless of version.

Source

pub fn orchard_note_commitments(&self) -> impl Iterator<Item = &Base>

Access the note commitments in this transaction, if there are any, regardless of version.

Source

pub fn orchard_flags(&self) -> Option<Flags>

Access the orchard::Flags in this transaction, if there is any, regardless of version.

Source

pub fn has_orchard_shielded_data(&self) -> bool

Return if the transaction has any Orchard shielded data, regardless of version.

Source

pub fn output_values_to_sprout( &self, ) -> Box<dyn Iterator<Item = &Amount<NonNegative>> + '_>

Returns the vpub_old fields from JoinSplits in this transaction, regardless of version, in the order they appear in the transaction.

These values are added to the sprout chain value pool, and removed from the value pool of this transaction.

Source

pub fn input_values_from_sprout( &self, ) -> Box<dyn Iterator<Item = &Amount<NonNegative>> + '_>

Returns the vpub_new fields from JoinSplits in this transaction, regardless of version, in the order they appear in the transaction.

These values are removed from the value pool of this transaction. and added to the sprout chain value pool.

Source

pub fn sapling_value_balance(&self) -> ValueBalance<NegativeAllowed>

Return the sapling value balance, the change in the transaction value pool due to sapling Spends and Outputs.

Returns the valueBalanceSapling field in this transaction.

Positive values are added to this transaction’s value pool, and removed from the sapling chain value pool. Negative values are removed from this transaction, and added to sapling pool.

https://zebra.zfnd.org/dev/rfcs/0012-value-pools.html#definitions

Source

pub fn sapling_binding_sig(&self) -> Option<Signature<Binding>>

Returns the Sapling binding signature for this transaction.

Returns Some(binding_sig) for transactions that contain Sapling shielded data (V4+), or None for transactions without Sapling components.

Source

pub fn joinsplit_pub_key(&self) -> Option<VerificationKeyBytes>

Returns the JoinSplit public key for this transaction.

Returns Some(pub_key) for transactions that contain JoinSplit data (V2-V4), or None for transactions without JoinSplit components or unsupported versions.

§Note

JoinSplits are deprecated in favor of Sapling and Orchard

Source

pub fn joinsplit_sig(&self) -> Option<Signature>

Returns the JoinSplit signature this for transaction.

Returns Some(signature) for transactions that contain JoinSplit data (V2-V4), or None for transactions without JoinSplit components or unsupported versions.

§Note

JoinSplits are deprecated in favor of Sapling and Orchard

Source

pub fn orchard_value_balance(&self) -> ValueBalance<NegativeAllowed>

Return the orchard value balance, the change in the transaction value pool due to orchard::Actions.

Returns the valueBalanceOrchard field in this transaction.

Positive values are added to this transaction’s value pool, and removed from the orchard chain value pool. Negative values are removed from this transaction, and added to orchard pool.

https://zebra.zfnd.org/dev/rfcs/0012-value-pools.html#definitions

Source

pub fn value_balance( &self, utxos: &HashMap<OutPoint, Utxo>, ) -> Result<ValueBalance<NegativeAllowed>, ValueBalanceError>

Returns the value balances for this transaction.

These are the changes in the transaction value pool, split up into transparent, Sprout, Sapling, and Orchard values.

Calculated as the sum of the inputs and outputs from each pool, or the sum of the value balances from each pool.

Positive values are added to this transaction’s value pool, and removed from the corresponding chain value pool. Negative values are removed from this transaction, and added to the corresponding pool.

https://zebra.zfnd.org/dev/rfcs/0012-value-pools.html#definitions

utxos must contain the utxos of every input in the transaction, including UTXOs created by earlier transactions in this block.

§Note

The chain value pool has the opposite sign to the transaction value pool.

Source

pub fn has_shielded_data(&self) -> bool

Does this transaction have shielded inputs or outputs?

Source

pub fn version_group_id(&self) -> Option<u32>

Get the version group ID for this transaction, if any.

Trait Implementations§

Source§

impl Clone for Transaction

Source§

fn clone(&self) -> Transaction

Returns a duplicate 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 Transaction

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Transaction

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<&Transaction> for AuthDigest

Source§

fn from(transaction: &Transaction) -> Self

Computes the authorizing data commitment for a transaction.

§Panics

If passed a pre-v5 transaction.

Source§

impl From<&Transaction> for Hash

Source§

fn from(transaction: &Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<&Transaction> for UnminedTx

Source§

fn from(transaction: &Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<&Transaction> for UnminedTxId

Source§

fn from(transaction: &Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<&Transaction> for WtxId

Source§

fn from(transaction: &Transaction) -> Self

Computes the witnessed transaction ID for a transaction.

§Panics

If passed a pre-v5 transaction.

Source§

impl From<Transaction> for AuthDigest

Source§

fn from(transaction: Transaction) -> Self

Computes the authorizing data commitment for a transaction.

§Panics

If passed a pre-v5 transaction.

Source§

impl From<Transaction> for Hash

Source§

fn from(transaction: Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<Transaction> for UnminedTx

Source§

fn from(transaction: Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<Transaction> for UnminedTxId

Source§

fn from(transaction: Transaction) -> Self

Converts to this type from the input type.
Source§

impl From<Transaction> for WtxId

Source§

fn from(transaction: Transaction) -> Self

Computes the witnessed transaction ID for a transaction.

§Panics

If passed a pre-v5 transaction.

Source§

impl PartialEq for Transaction

Source§

fn eq(&self, other: &Transaction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TrustedPreallocate for Transaction

No valid Zcash message contains more transactions than can fit in a single block

tx messages contain a single transaction, and block messages are limited to the maximum block size.

Source§

fn max_allocation() -> u64

Provides a loose upper bound on the size of the Vec<T: TrustedPreallocate> which can possibly be received from an honest peer.
Source§

impl ZcashDeserialize for Transaction

Source§

fn zcash_deserialize<R: Read>(reader: R) -> Result<Self, SerializationError>

Try to read self from the given reader. Read more
Source§

impl ZcashSerialize for Transaction

Source§

fn zcash_serialize<W: Write>(&self, writer: W) -> Result<(), Error>

Write self to the given writer using the canonical format. Read more
Source§

fn zcash_serialize_to_vec(&self) -> Result<Vec<u8>, Error>

Helper function to construct a vec to serialize the current struct into
Source§

fn zcash_serialized_size(&self) -> usize

Get the size of self by using a fake writer.
Source§

impl Eq for Transaction

Source§

impl StructuralPartialEq for Transaction

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
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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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> 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> 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> 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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<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