Struct Transaction
pub struct Transaction<T>where
T: TransactionType,{
pub tx_data: CommonTransactionData,
pub type_data: T,
}Expand description
A generic transaction in the delta protocol.
Transactions contain two main components:
- Common data shared across all transaction types (sender, nonce, epoch, fee);
- Type-specific data that varies based on the transaction type.
The generic parameter T represents the specific transaction type.
Fields§
§tx_data: CommonTransactionDataCommon transaction data
type_data: TType-specific transaction data
Implementations§
§impl<T> Transaction<T>where
T: TransactionType,
impl<T> Transaction<T>where
T: TransactionType,
pub const fn fee(&self) -> TransactionFee
pub const fn fee(&self) -> TransactionFee
Returns the fee structure for this transaction.
pub fn validate(&self) -> Result<(), TransactionValidationError>
pub fn validate(&self) -> Result<(), TransactionValidationError>
Validates this transaction by checking the type-specific validation rules.
§Errors
Returns a TransactionValidationError if the transaction type validation fails.
Trait Implementations§
§impl<T> Clone for Transaction<T>where
T: Clone + TransactionType,
impl<T> Clone for Transaction<T>where
T: Clone + TransactionType,
§fn clone(&self) -> Transaction<T>
fn clone(&self) -> Transaction<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<T> Debug for Transaction<T>where
T: Debug + TransactionType,
impl<T> Debug for Transaction<T>where
T: Debug + TransactionType,
§impl<'de, T> Deserialize<'de> for Transaction<T>where
T: TransactionType + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Transaction<T>where
T: TransactionType + Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Transaction<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Transaction<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> PartialEq for Transaction<T>where
T: PartialEq + TransactionType,
impl<T> PartialEq for Transaction<T>where
T: PartialEq + TransactionType,
§impl<T> Serialize for Transaction<T>where
T: TransactionType + Serialize,
impl<T> Serialize for Transaction<T>where
T: TransactionType + Serialize,
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl<T> TryFrom<Transaction> for Transaction<T>where
T: TransactionType + TryFrom<Transaction, Error = ProtoError>,
impl<T> TryFrom<Transaction> for Transaction<T>where
T: TransactionType + TryFrom<Transaction, Error = ProtoError>,
§fn try_from(
wire_tx: Transaction,
) -> Result<Transaction<T>, <Transaction<T> as TryFrom<Transaction>>::Error>
fn try_from( wire_tx: Transaction, ) -> Result<Transaction<T>, <Transaction<T> as TryFrom<Transaction>>::Error>
Performs the conversion.
§impl<T> TryHash256 for Transaction<T>where
T: TransactionType,
impl<T> TryHash256 for Transaction<T>where
T: TransactionType,
§fn try_hash_sha256(&self) -> Result<HashDigest, SerializationError>
fn try_hash_sha256(&self) -> Result<HashDigest, SerializationError>
Try to hash the type
impl<T> Eq for Transaction<T>where
T: Eq + TransactionType,
impl<T> StructuralPartialEq for Transaction<T>where
T: TransactionType,
Auto Trait Implementations§
impl<T> Freeze for Transaction<T>where
T: Freeze,
impl<T> RefUnwindSafe for Transaction<T>where
T: RefUnwindSafe,
impl<T> Send for Transaction<T>where
T: Send,
impl<T> Sync for Transaction<T>where
T: Sync,
impl<T> Unpin for Transaction<T>where
T: Unpin,
impl<T> UnwindSafe for Transaction<T>where
T: 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key and return true if they are equal.§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
Checks if this value is equivalent to the given key. Read more
§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
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request