Struct tor_netdoc::doc::netstatus::ConsensusBuilder
source · [−]pub struct ConsensusBuilder<RS> { /* private fields */ }
Expand description
A builder object used to construct a consensus.
Create one of these with the Consensus::builder
method.
This facility is only enabled when the crate is built with
the build_docs
feature.
Implementations
sourceimpl<RS> ConsensusBuilder<RS>
impl<RS> ConsensusBuilder<RS>
sourcepub fn lifetime(&mut self, lifetime: Lifetime) -> &mut Self
pub fn lifetime(&mut self, lifetime: Lifetime) -> &mut Self
Set the lifetime of this consensus.
This value is required.
sourcepub fn add_client_version(&mut self, ver: String) -> &mut Self
pub fn add_client_version(&mut self, ver: String) -> &mut Self
Add a single recommended Tor client version to this consensus.
These values are optional for testing.
sourcepub fn add_relay_version(&mut self, ver: String) -> &mut Self
pub fn add_relay_version(&mut self, ver: String) -> &mut Self
Add a single recommended Tor relay version to this consensus.
These values are optional for testing.
sourcepub fn required_client_protos(&mut self, protos: Protocols) -> &mut Self
pub fn required_client_protos(&mut self, protos: Protocols) -> &mut Self
Set the required client protocol versions for this consensus.
This value defaults to “no protocol versions required.”
sourcepub fn recommended_client_protos(&mut self, protos: Protocols) -> &mut Self
pub fn recommended_client_protos(&mut self, protos: Protocols) -> &mut Self
Set the recommended client protocol versions for this consensus.
This value defaults to “no protocol versions recommended.”
sourcepub fn required_relay_protos(&mut self, protos: Protocols) -> &mut Self
pub fn required_relay_protos(&mut self, protos: Protocols) -> &mut Self
Set the required relay protocol versions for this consensus.
This value defaults to “no protocol versions required.”
sourcepub fn recommended_relay_protos(&mut self, protos: Protocols) -> &mut Self
pub fn recommended_relay_protos(&mut self, protos: Protocols) -> &mut Self
Set the recommended client protocol versions for this consensus.
This value defaults to “no protocol versions recommended.”
sourcepub fn param<S>(&mut self, param: S, val: i32) -> &mut Self where
S: Into<String>,
pub fn param<S>(&mut self, param: S, val: i32) -> &mut Self where
S: Into<String>,
Set the value for a given consensus parameter by name.
sourcepub fn voting_delay(
&mut self,
vote_delay: u32,
signature_delay: u32
) -> &mut Self
pub fn voting_delay(
&mut self,
vote_delay: u32,
signature_delay: u32
) -> &mut Self
Set the voting delays (in seconds) for this consensus.
sourcepub fn consensus_method(&mut self, consensus_method: u32) -> &mut Self
pub fn consensus_method(&mut self, consensus_method: u32) -> &mut Self
Set the declared consensus method for this consensus.
This value is required.
Set the previous day’s shared-random value for this consensus.
This value is optional.
Set the current day’s shared-random value for this consensus.
This value is optional.
sourcepub fn weight<S>(&mut self, param: S, val: i32) -> &mut Self where
S: Into<String>,
pub fn weight<S>(&mut self, param: S, val: i32) -> &mut Self where
S: Into<String>,
Set a named weight parameter for this consensus.
sourceimpl<RS: RouterStatus + Clone> ConsensusBuilder<RS>
impl<RS: RouterStatus + Clone> ConsensusBuilder<RS>
sourcepub fn rs(&self) -> RouterStatusBuilder<RS::DocumentDigest>
pub fn rs(&self) -> RouterStatusBuilder<RS::DocumentDigest>
Create a RouterStatusBuilder to add a RouterStatus to this builder.
You can make a consensus with no RouterStatus entries, but it won’t actually be good for anything.
sourcepub fn testing_consensus(&self) -> Result<Consensus<RS>>
pub fn testing_consensus(&self) -> Result<Consensus<RS>>
Try to create a consensus object from this builder.
This object might not have all of the data that a valid consensus would have. Therefore, it should only be used for testing.
Auto Trait Implementations
impl<RS> RefUnwindSafe for ConsensusBuilder<RS> where
RS: RefUnwindSafe,
impl<RS> Send for ConsensusBuilder<RS> where
RS: Send,
impl<RS> Sync for ConsensusBuilder<RS> where
RS: Sync,
impl<RS> Unpin for ConsensusBuilder<RS> where
RS: Unpin,
impl<RS> UnwindSafe for ConsensusBuilder<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