Enum zebra_chain::sapling::shielded_data::TransferData
source · pub enum TransferData<AnchorV>where
AnchorV: AnchorVariant + Clone,{
SpendsAndMaybeOutputs {
shared_anchor: AnchorV::Shared,
spends: AtLeastOne<Spend<AnchorV>>,
maybe_outputs: Vec<Output>,
},
JustOutputs {
outputs: AtLeastOne<Output>,
},
}Expand description
A bundle of Spend and Output descriptions, and a shared anchor.
This wrapper type bundles at least one Spend or Output description with
the required anchor data, so that an Option<ShieldedData> (which contains
this type) correctly models the presence or absence of any spends and
shielded data, across both V4 and V5 transactions.
Specifically, TransferData ensures that:
- there is at least one spend or output, and
- the shared anchor is only present when there are spends.
Variants§
SpendsAndMaybeOutputs
Fields
The shared anchor for all Spends in this transaction.
The anchor is the root of the Sapling note commitment tree in a previous block. This root should be in the best chain for a transaction to be mined, and it must be in the relevant chain for a transaction to be valid.
Some transaction versions have a per-spend anchor, rather than a shared anchor.
Use the shared_anchor method to access this field.
spends: AtLeastOne<Spend<AnchorV>>At least one spend.
Use the ShieldedData::spends method to get an iterator over the
Spends in this TransferData.
maybe_outputs: Vec<Output>Maybe some outputs (can be empty), in the order they appear in the transaction.
Use the ShieldedData::outputs method to get an iterator over the
Outputs in this TransferData.
A bundle containing at least one spend, and the shared spend anchor. There can also be zero or more outputs.
In Transaction::V5, if there are any spends, there must also be a shared spend anchor.
JustOutputs
Fields
outputs: AtLeastOne<Output>At least one output, in the order they appear in the transaction.
Use the ShieldedData::outputs method to get an iterator over the
Outputs in this TransferData.
A bundle containing at least one output, with no spends and no shared spend anchor.
In Transaction::V5, if there are no spends, there must not be a shared anchor.
Implementations§
source§impl<AnchorV> TransferData<AnchorV>where
AnchorV: AnchorVariant + Clone,
Spend<PerSpendAnchor>: From<(Spend<AnchorV>, AnchorV::Shared)>,
impl<AnchorV> TransferData<AnchorV>where
AnchorV: AnchorVariant + Clone,
Spend<PerSpendAnchor>: From<(Spend<AnchorV>, AnchorV::Shared)>,
sourcepub fn spends_per_anchor(
&self
) -> impl Iterator<Item = Spend<PerSpendAnchor>> + '_
pub fn spends_per_anchor( &self ) -> impl Iterator<Item = Spend<PerSpendAnchor>> + '_
Iterate over the Spends for this transaction, returning
Spend<PerSpendAnchor> regardless of the underlying transaction version.
Allows generic operations over V4 and V5 transactions, including:
- spend verification, and
- non-malleable transaction ID generation.
§Correctness
Do not use this function for serialization.
source§impl<AnchorV> TransferData<AnchorV>where
AnchorV: AnchorVariant + Clone,
impl<AnchorV> TransferData<AnchorV>where
AnchorV: AnchorVariant + Clone,
sourcepub fn spends(&self) -> impl Iterator<Item = &Spend<AnchorV>>
pub fn spends(&self) -> impl Iterator<Item = &Spend<AnchorV>>
Iterate over the Spends for this transaction, returning them as
their generic type.
sourcepub fn outputs(&self) -> impl Iterator<Item = &Output>
pub fn outputs(&self) -> impl Iterator<Item = &Output>
Iterate over the Outputs for this transaction.
Provide the shared anchor for this transaction, if present.
The shared anchor is only present if:
- there is at least one spend, and
- this is a
V5transaction.
Trait Implementations§
source§impl<AnchorV> Clone for TransferData<AnchorV>
impl<AnchorV> Clone for TransferData<AnchorV>
source§fn clone(&self) -> TransferData<AnchorV>
fn clone(&self) -> TransferData<AnchorV>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<AnchorV> Debug for TransferData<AnchorV>
impl<AnchorV> Debug for TransferData<AnchorV>
source§impl<'de, AnchorV> Deserialize<'de> for TransferData<AnchorV>
impl<'de, AnchorV> Deserialize<'de> for TransferData<AnchorV>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<AnchorV> PartialEq for TransferData<AnchorV>
impl<AnchorV> PartialEq for TransferData<AnchorV>
source§fn eq(&self, other: &TransferData<AnchorV>) -> bool
fn eq(&self, other: &TransferData<AnchorV>) -> bool
self and other values to be equal, and is used
by ==.source§impl<AnchorV> Serialize for TransferData<AnchorV>
impl<AnchorV> Serialize for TransferData<AnchorV>
impl<AnchorV> Eq for TransferData<AnchorV>
impl<AnchorV> StructuralPartialEq for TransferData<AnchorV>where
AnchorV: AnchorVariant + Clone,
Auto Trait Implementations§
impl<AnchorV> RefUnwindSafe for TransferData<AnchorV>where
<AnchorV as AnchorVariant>::PerSpend: RefUnwindSafe,
<AnchorV as AnchorVariant>::Shared: RefUnwindSafe,
impl<AnchorV> Send for TransferData<AnchorV>
impl<AnchorV> Sync for TransferData<AnchorV>
impl<AnchorV> Unpin for TransferData<AnchorV>
impl<AnchorV> UnwindSafe for TransferData<AnchorV>where
<AnchorV as AnchorVariant>::PerSpend: UnwindSafe,
<AnchorV as AnchorVariant>::Shared: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.