pub struct PartialNetDir { /* private fields */ }
Expand description
A partially build NetDir – it can’t be unwrapped until it has enough information to build safe paths.
Implementations§
Source§impl PartialNetDir
impl PartialNetDir
Sourcepub fn new(
consensus: MdConsensus,
replacement_params: Option<&NetParams<i32>>,
) -> Self
pub fn new( consensus: MdConsensus, replacement_params: Option<&NetParams<i32>>, ) -> Self
Create a new PartialNetDir with a given consensus, and no microdescriptors loaded.
If replacement_params
is provided, override network parameters from
the consensus with those from replacement_params
.
Sourcepub fn new_with_geoip(
consensus: MdConsensus,
replacement_params: Option<&NetParams<i32>>,
geoip_db: &GeoipDb,
) -> Self
Available on crate feature geoip
only.
pub fn new_with_geoip( consensus: MdConsensus, replacement_params: Option<&NetParams<i32>>, geoip_db: &GeoipDb, ) -> Self
geoip
only.Create a new PartialNetDir with GeoIP support.
This does the same thing as new()
, except the provided GeoIP database is used to add
country codes to relays.
Sourcepub fn fill_from_previous_netdir(&mut self, prev: Arc<NetDir>)
pub fn fill_from_previous_netdir(&mut self, prev: Arc<NetDir>)
Record a previous netdir, which can be used for reusing cached information
Sourcepub fn have_enough_paths(&self) -> bool
pub fn have_enough_paths(&self) -> bool
Return true if this are enough information in this directory to build multihop paths.
Sourcepub fn unwrap_if_sufficient(self) -> Result<NetDir, PartialNetDir>
pub fn unwrap_if_sufficient(self) -> Result<NetDir, PartialNetDir>
If this directory has enough information to build multihop circuits, return it.
Trait Implementations§
Source§impl Clone for PartialNetDir
impl Clone for PartialNetDir
Source§fn clone(&self) -> PartialNetDir
fn clone(&self) -> PartialNetDir
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PartialNetDir
impl Debug for PartialNetDir
Source§impl MdReceiver for PartialNetDir
impl MdReceiver for PartialNetDir
Auto Trait Implementations§
impl Freeze for PartialNetDir
impl RefUnwindSafe for PartialNetDir
impl Send for PartialNetDir
impl Sync for PartialNetDir
impl Unpin for PartialNetDir
impl UnwindSafe for PartialNetDir
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for 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>
Converts
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>
Converts
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