#[non_exhaustive]pub struct Consensus<RS> {
pub header: ConsensusHeader,
pub voters: Vec<ConsensusVoterInfo>,
pub relays: Vec<RS>,
pub footer: Footer,
}
Expand description
A single microdescriptor consensus netstatus
TODO: This should possibly turn into a parameterized type, to represent votes and ns consensuses.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.header: ConsensusHeader
Part of the header shared by all consensus types.
voters: Vec<ConsensusVoterInfo>
List of voters whose votes contributed to this consensus.
relays: Vec<RS>
A list of routerstatus entries for the relays on the network, with one entry per relay.
Footer for the consensus object.
Implementations
sourceimpl<RS> Consensus<RS>
impl<RS> Consensus<RS>
sourcepub fn relays(&self) -> &[RS]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn relays(&self) -> &[RS]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Return a slice of all the routerstatus entries in this consensus.
sourcepub fn bandwidth_weights(&self) -> &NetParams<i32>
pub fn bandwidth_weights(&self) -> &NetParams<i32>
Return a mapping from keywords to integers representing how to weight different kinds of relays in different path positions.
sourceimpl<RS: RouterStatus + ParseRouterStatus> Consensus<RS>
impl<RS: RouterStatus + ParseRouterStatus> Consensus<RS>
sourcepub fn builder() -> ConsensusBuilder<RS>
pub fn builder() -> ConsensusBuilder<RS>
Return a new ConsensusBuilder for building test consensus objects.
This function is only available when the build_docs
feature has
been enabled.
Trait Implementations
sourceimpl<RS> ExternallySigned<Consensus<RS>> for UnvalidatedConsensus<RS>
impl<RS> ExternallySigned<Consensus<RS>> for UnvalidatedConsensus<RS>
type KeyHint = Vec<AuthCertKeyIds, Global>
type KeyHint = Vec<AuthCertKeyIds, Global>
A type that describes what keys are missing for this object.
sourcefn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>
fn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>
Check whether k is the right key for this object. If not, return an error describing what key would be right. Read more
sourcefn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>
fn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>
Check the signature on this object
sourcefn dangerously_assume_wellsigned(self) -> Consensus<RS>
fn dangerously_assume_wellsigned(self) -> Consensus<RS>
Unwrap this object without checking any signatures on it.
sourcefn check_signature(self, k: &Self::Key) -> Result<T, Self::Error>
fn check_signature(self, k: &Self::Key) -> Result<T, Self::Error>
Unwrap this object if it’s correctly signed by a provided key.
Auto Trait Implementations
impl<RS> RefUnwindSafe for Consensus<RS> where
RS: RefUnwindSafe,
impl<RS> Send for Consensus<RS> where
RS: Send,
impl<RS> Sync for Consensus<RS> where
RS: Sync,
impl<RS> Unpin for Consensus<RS> where
RS: Unpin,
impl<RS> UnwindSafe for Consensus<RS> where
RS: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more