pub struct MdConsensusBuilder { /* 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 ConsensusBuilder
impl ConsensusBuilder
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 ConsensusBuilder
impl ConsensusBuilder
Sourcepub fn rs(&self) -> RouterStatusBuilder
pub fn rs(&self) -> RouterStatusBuilder
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>
pub fn testing_consensus(&self) -> Result<Consensus>
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 Freeze for ConsensusBuilder
impl RefUnwindSafe for ConsensusBuilder
impl Send for ConsensusBuilder
impl Sync for ConsensusBuilder
impl Unpin for ConsensusBuilder
impl UnwindSafe for ConsensusBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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