Struct tor_netdoc::doc::netstatus::ConsensusBuilder
source · pub struct ConsensusBuilder<RS> { /* private fields */ }
build_docs
only.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§
source§impl<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
pub fn param<S>(&mut self, param: S, val: i32) -> &mut Self
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
pub fn weight<S>(&mut self, param: S, val: i32) -> &mut Self
Set a named weight parameter for this consensus.
source§impl<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> Freeze for ConsensusBuilder<RS>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more