[−][src]Struct parsec::Block
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]
(participants, dkg_result): (BTreeSet<P>, DkgResult)
) -> Self
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]
&mut self,
peer_id: &P,
vote: &Vote<T, P>
) -> Result<bool, Error>
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]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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]
pub fn cmp(&self, other: &Block<T, P>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq + NetworkEvent, P: PartialEq + PublicId> PartialEq<Block<T, P>> for Block<T, P>
[src]
pub fn eq(&self, other: &Block<T, P>) -> bool
[src]
pub fn ne(&self, other: &Block<T, P>) -> bool
[src]
impl<T: PartialOrd + NetworkEvent, P: PartialOrd + PublicId> PartialOrd<Block<T, P>> for Block<T, P>
[src]
pub fn partial_cmp(&self, other: &Block<T, P>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Block<T, P>) -> bool
[src]
pub fn le(&self, other: &Block<T, P>) -> bool
[src]
pub fn gt(&self, other: &Block<T, P>) -> bool
[src]
pub fn ge(&self, other: &Block<T, P>) -> bool
[src]
impl<T: NetworkEvent, P: PublicId> Serialize for Block<T, P>
[src]
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
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,
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,
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,
P: Sync,
T: Sync,
<P as PublicId>::Signature: Sync,
impl<T, P> Unpin for Block<T, P> where
P: Unpin,
T: Unpin,
P: Unpin,
T: Unpin,
impl<T, P> UnwindSafe for Block<T, P> where
P: RefUnwindSafe + UnwindSafe,
T: UnwindSafe,
<P as PublicId>::Signature: RefUnwindSafe + UnwindSafe,
P: RefUnwindSafe + UnwindSafe,
T: UnwindSafe,
<P as PublicId>::Signature: RefUnwindSafe + UnwindSafe,
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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.
pub 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>,