Struct parsec::Vote [−][src]
pub struct Vote<T: NetworkEvent, P: PublicId> { /* fields omitted */ }
A helper struct carrying some data and a signature of this data.
Methods
impl<T: NetworkEvent, P: PublicId> Vote<T, P>
[src]
impl<T: NetworkEvent, P: PublicId> Vote<T, P>
pub fn new<S: SecretId<PublicId = P>>(
secret_id: &S,
payload: T
) -> Result<Self, Error>
[src]
pub fn new<S: SecretId<PublicId = P>>(
secret_id: &S,
payload: T
) -> Result<Self, Error>
Creates a Vote
for payload
.
pub fn payload(&self) -> &T
[src]
pub fn payload(&self) -> &T
Returns the payload being voted for.
pub fn signature(&self) -> &P::Signature
[src]
pub fn signature(&self) -> &P::Signature
Returns the signature of this Vote
's payload.
pub fn is_valid(&self, public_id: &P) -> bool
[src]
pub fn is_valid(&self, public_id: &P) -> bool
Validates this Vote
's signature and payload against the given public ID.
pub fn create_proof(&self, public_id: &P) -> Result<Proof<P>, Error>
[src]
pub fn create_proof(&self, public_id: &P) -> Result<Proof<P>, Error>
Creates a Proof
from this Vote
. Returns Err
if this Vote
is not valid (i.e. if
!self.is_valid()
).
Trait Implementations
impl<T: Clone + NetworkEvent, P: Clone + PublicId> Clone for Vote<T, P> where
P::Signature: Clone,
[src]
impl<T: Clone + NetworkEvent, P: Clone + PublicId> Clone for Vote<T, P> where
P::Signature: Clone,
fn clone(&self) -> Vote<T, P>
[src]
fn clone(&self) -> Vote<T, P>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: PartialEq + NetworkEvent, P: PartialEq + PublicId> PartialEq for Vote<T, P> where
P::Signature: PartialEq,
[src]
impl<T: PartialEq + NetworkEvent, P: PartialEq + PublicId> PartialEq for Vote<T, P> where
P::Signature: PartialEq,
fn eq(&self, other: &Vote<T, P>) -> bool
[src]
fn eq(&self, other: &Vote<T, P>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Vote<T, P>) -> bool
[src]
fn ne(&self, other: &Vote<T, P>) -> bool
This method tests for !=
.
impl<T: Eq + NetworkEvent, P: Eq + PublicId> Eq for Vote<T, P> where
P::Signature: Eq,
[src]
impl<T: Eq + NetworkEvent, P: Eq + PublicId> Eq for Vote<T, P> where
P::Signature: Eq,
impl<T: PartialOrd + NetworkEvent, P: PartialOrd + PublicId> PartialOrd for Vote<T, P> where
P::Signature: PartialOrd,
[src]
impl<T: PartialOrd + NetworkEvent, P: PartialOrd + PublicId> PartialOrd for Vote<T, P> where
P::Signature: PartialOrd,
fn partial_cmp(&self, other: &Vote<T, P>) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Vote<T, P>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Vote<T, P>) -> bool
[src]
fn lt(&self, other: &Vote<T, P>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Vote<T, P>) -> bool
[src]
fn le(&self, other: &Vote<T, P>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Vote<T, P>) -> bool
[src]
fn gt(&self, other: &Vote<T, P>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Vote<T, P>) -> bool
[src]
fn ge(&self, other: &Vote<T, P>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Ord + NetworkEvent, P: Ord + PublicId> Ord for Vote<T, P> where
P::Signature: Ord,
[src]
impl<T: Ord + NetworkEvent, P: Ord + PublicId> Ord for Vote<T, P> where
P::Signature: Ord,
fn cmp(&self, other: &Vote<T, P>) -> Ordering
[src]
fn cmp(&self, other: &Vote<T, P>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl<T: Debug + NetworkEvent, P: Debug + PublicId> Debug for Vote<T, P> where
P::Signature: Debug,
[src]
impl<T: Debug + NetworkEvent, P: Debug + PublicId> Debug for Vote<T, P> where
P::Signature: Debug,