Struct rings_core::message::Transaction
source · pub struct Transaction {
pub destination: Did,
pub tx_id: Uuid,
pub data: Vec<u8>,
pub verification: MessageVerification,
}Expand description
All messages transmitted in RingsNetwork should be wrapped by Transaction.
It additionally offer destination, tx_id and verification.
To transmit Transaction in RingsNetwork, user should build
MessagePayload and use PayloadSender to send.
Fields§
§destination: DidThe destination of this message.
tx_id: UuidThe transaction ID. Remote peer should use same tx_id when response.
data: Vec<u8>data
verification: MessageVerificationThis field holds a signature from a node, which is used to prove that the transaction was created by that node.
Implementations§
source§impl Transaction
impl Transaction
sourcepub fn new<T>(
destination: Did,
tx_id: Uuid,
data: T,
session_sk: &SessionSk
) -> Result<Self>where
T: Serialize,
pub fn new<T>(
destination: Did,
tx_id: Uuid,
data: T,
session_sk: &SessionSk
) -> Result<Self>where
T: Serialize,
Wrap data. Will serialize by bincode::serialize then sign MessageVerification by session_sk.
sourcepub fn data<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn data<T>(&self) -> Result<T>where
T: DeserializeOwned,
Deserializes the data field into a T instance.
Trait Implementations§
source§impl Clone for Transaction
impl Clone for Transaction
source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
Returns a copy 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 moresource§impl Debug for Transaction
impl Debug for Transaction
source§impl<'de> Deserialize<'de> for Transaction
impl<'de> Deserialize<'de> for Transaction
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl MessageVerificationExt for Transaction
impl MessageVerificationExt for Transaction
source§fn verification(&self) -> &MessageVerification
fn verification(&self) -> &MessageVerification
Give the verification field for verifying.
source§fn is_expired(&self) -> bool
fn is_expired(&self) -> bool
Checks whether the message is expired.
source§impl PartialEq for Transaction
impl PartialEq for Transaction
source§fn eq(&self, other: &Transaction) -> bool
fn eq(&self, other: &Transaction) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for Transaction
impl Serialize for Transaction
impl Eq for Transaction
impl StructuralPartialEq for Transaction
Auto Trait Implementations§
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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