[][src]Struct parsec::Block

pub struct Block<T: NetworkEvent, P: PublicId> { /* fields omitted */ }

A struct representing a collection of votes by peers for an Observation.

Implementations

impl<T: NetworkEvent, P: PublicId> Block<T, P>[src]

pub fn new_dkg_block(
    (participants, dkg_result): (BTreeSet<P>, DkgResult)
) -> Self
[src]

Create a Block with no signatures for a single DkgResult

pub fn new(votes: &BTreeMap<P, Vote<T, P>>) -> Result<Self, Error>[src]

Creates a Block from votes.

pub fn payload(&self) -> &Observation<T, P>[src]

Returns the payload of this block.

pub fn proofs(&self) -> &BTreeSet<Proof<P>>[src]

Returns the proofs of this block.

pub fn is_signed_by(&self, peer_id: &P) -> bool[src]

Is this block signed by the given peer?

pub fn add_vote(
    &mut self,
    peer_id: &P,
    vote: &Vote<T, P>
) -> Result<bool, Error>
[src]

Converts vote to a Proof and attempts to add it to the block. Returns an error if vote is invalid (i.e. signature check fails or the vote is for a different network event), Ok(true) if the Proof wasn't previously held in this Block, or Ok(false) if it was previously held.

Trait Implementations

impl<T: Clone + NetworkEvent, P: Clone + PublicId> Clone for Block<T, P>[src]

impl<T: Debug + NetworkEvent, P: Debug + PublicId> Debug for Block<T, P>[src]

impl<'de, T: NetworkEvent, P: PublicId> Deserialize<'de> for Block<T, P>[src]

impl<T: Eq + NetworkEvent, P: Eq + PublicId> Eq for Block<T, P>[src]

impl<T: Ord + NetworkEvent, P: Ord + PublicId> Ord for Block<T, P>[src]

impl<T: PartialEq + NetworkEvent, P: PartialEq + PublicId> PartialEq<Block<T, P>> for Block<T, P>[src]

impl<T: PartialOrd + NetworkEvent, P: PartialOrd + PublicId> PartialOrd<Block<T, P>> for Block<T, P>[src]

impl<T: NetworkEvent, P: PublicId> Serialize for Block<T, P>[src]

impl<T: NetworkEvent, P: PublicId> StructuralEq for Block<T, P>[src]

impl<T: NetworkEvent, P: PublicId> StructuralPartialEq for Block<T, P>[src]

Auto Trait Implementations

impl<T, P> RefUnwindSafe for Block<T, P> where
    P: RefUnwindSafe,
    T: RefUnwindSafe,
    <P as PublicId>::Signature: RefUnwindSafe

impl<T, P> Send for Block<T, P> where
    P: Send,
    T: Send,
    <P as PublicId>::Signature: Send

impl<T, P> Sync for Block<T, P> where
    P: Sync,
    T: Sync,
    <P as PublicId>::Signature: Sync

impl<T, P> Unpin for Block<T, P> where
    P: Unpin,
    T: Unpin,
    <P as PublicId>::Signature: Unpin

impl<T, P> UnwindSafe for Block<T, P> where
    P: RefUnwindSafe + UnwindSafe,
    T: UnwindSafe,
    <P as PublicId>::Signature: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,