[−][src]Struct xaynet::message::Sum
A high level representation of a sum message.
These messages are sent by sum participants during the sum phase.
Examples
Decoding a message
let signature = vec![0x11; 64]; let ephm_pk = vec![0x22; 32]; let bytes = [signature.as_slice(), ephm_pk.as_slice()].concat(); let parsed = SumOwned::from_bytes(&bytes).unwrap(); let expected = SumOwned { sum_signature: ParticipantTaskSignature::from_slice(&signature[..]).unwrap(), ephm_pk: SumParticipantEphemeralPublicKey::from_slice(&ephm_pk[..]).unwrap(), }; assert_eq!(parsed, expected);
Encoding a message
let sum_signature = ParticipantTaskSignature::from_slice(vec![0x11; 64].as_slice()).unwrap(); let ephm_pk = SumParticipantEphemeralPublicKey::from_slice(vec![0x22; 32].as_slice()).unwrap(); let msg = Sum { sum_signature, ephm_pk, }; // we need a 96 bytes long buffer to serialize that message assert_eq!(msg.buffer_length(), 96); // create a buffer with enough space and encode the message let mut buf = vec![0xff; 96]; msg.to_bytes(&mut buf); assert_eq!(buf, [vec![0x11; 64].as_slice(), vec![0x22; 32].as_slice()].concat());
Fields
sum_signature: ParticipantTaskSignature
The signature of the round seed and the word "sum".
This is used to determine whether a participant is selected for the sum task.
ephm_pk: SumParticipantEphemeralPublicKey
An ephemeral public key generated by a sum participant for the current round.
Trait Implementations
impl Clone for Sum
[src]
impl Debug for Sum
[src]
impl Eq for Sum
[src]
impl<D, M, N> From<Sum> for Payload<D, M, N>
[src]
impl PartialEq<Sum> for Sum
[src]
impl StructuralEq for Sum
[src]
impl StructuralPartialEq for Sum
[src]
impl ToBytes for Sum
[src]
Auto Trait Implementations
impl RefUnwindSafe for Sum
impl Send for Sum
impl Sync for Sum
impl Unpin for Sum
impl UnwindSafe for Sum
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,