pub struct BridgeConfigBuilder {
transport: Option<String>,
addrs: Option<Vec<BridgeAddr>>,
ids: Option<Vec<RelayId>>,
settings: Option<Vec<(String, String)>>,
}
bridge-client
only.Expand description
Builder for a BridgeConfig
.
Construct this with BridgeConfigBuilder::default()
or BridgeConfig::builder()
,
call setter methods, and then call build().
Fields§
§transport: Option<String>
The PtTransportName
, but not yet parsed or checked.
""
and "-"
and "bridge"
all mean “do not use a pluggable transport”.
addrs: Option<Vec<BridgeAddr>>
Host:ORPort
When using a pluggable transport, only one address is allowed.
ids: Option<Vec<RelayId>>
IDs
No more than one ID of each type is permitted.
settings: Option<Vec<(String, String)>>
Settings (for the transport)
Implementations§
Source§impl BridgeConfigBuilder
impl BridgeConfigBuilder
Sourcepub fn transport(&mut self, transport: impl Into<String>) -> &mut Self
pub fn transport(&mut self, transport: impl Into<String>) -> &mut Self
Set the transport protocol name (eg, a pluggable transport) to use.
The empty string ""
, a single hyphen "-"
, and the word "bridge"
,
all mean to connect directly;
i.e., passing one of this is equivalent to
calling direct()
.
The value is not checked at this point.
Sourcepub fn push_setting(
&mut self,
k: impl Into<String>,
v: impl Into<String>,
) -> &mut Self
pub fn push_setting( &mut self, k: impl Into<String>, v: impl Into<String>, ) -> &mut Self
Add a pluggable transport setting
Sourcepub fn get_transport(&self) -> Option<&str>
pub fn get_transport(&self) -> Option<&str>
Inspect the transport name (ie, the protocol)
Has not necessarily been validated, so not a PtTransportName
.
If none has yet been specified, returns None
.
Source§impl BridgeConfigBuilder
impl BridgeConfigBuilder
Sourcepub fn build(&self) -> Result<BridgeConfig, ConfigBuildError>
pub fn build(&self) -> Result<BridgeConfig, ConfigBuildError>
Build a BridgeConfig
Source§impl BridgeConfigBuilder
impl BridgeConfigBuilder
Sourcepub fn addrs(&mut self) -> &mut Vec<BridgeAddr>
pub fn addrs(&mut self) -> &mut Vec<BridgeAddr>
Access the being-built list (resolving default)
If the field has not yet been set or accessed, the default list will be constructed and a mutable reference to the now-defaulted list of builders will be returned.
Sourcepub fn set_addrs(&mut self, list: Vec<BridgeAddr>)
pub fn set_addrs(&mut self, list: Vec<BridgeAddr>)
Set the whole list (overriding the default)
Sourcepub fn opt_addrs(&self) -> &Option<Vec<BridgeAddr>>
pub fn opt_addrs(&self) -> &Option<Vec<BridgeAddr>>
Inspect the being-built list (with default unresolved)
If the list has not yet been set, or accessed, &None
is returned.
Sourcepub fn opt_addrs_mut(&mut self) -> &mut Option<Vec<BridgeAddr>>
pub fn opt_addrs_mut(&mut self) -> &mut Option<Vec<BridgeAddr>>
Mutably access the being-built list (with default unresolved)
If the list has not yet been set, or accessed, &mut None
is returned.
Sourcepub fn ids(&mut self) -> &mut Vec<RelayId>
pub fn ids(&mut self) -> &mut Vec<RelayId>
Access the being-built list (resolving default)
If the field has not yet been set or accessed, the default list will be constructed and a mutable reference to the now-defaulted list of builders will be returned.
Sourcepub fn opt_ids(&self) -> &Option<Vec<RelayId>>
pub fn opt_ids(&self) -> &Option<Vec<RelayId>>
Inspect the being-built list (with default unresolved)
If the list has not yet been set, or accessed, &None
is returned.
Sourcepub fn opt_ids_mut(&mut self) -> &mut Option<Vec<RelayId>>
pub fn opt_ids_mut(&mut self) -> &mut Option<Vec<RelayId>>
Mutably access the being-built list (with default unresolved)
If the list has not yet been set, or accessed, &mut None
is returned.
Sourcepub fn settings(&mut self) -> &mut Vec<(String, String)>
pub fn settings(&mut self) -> &mut Vec<(String, String)>
Access the being-built list (resolving default)
If the field has not yet been set or accessed, the default list will be constructed and a mutable reference to the now-defaulted list of builders will be returned.
Sourcepub fn set_settings(&mut self, list: Vec<(String, String)>)
pub fn set_settings(&mut self, list: Vec<(String, String)>)
Set the whole list (overriding the default)
Trait Implementations§
Source§impl Builder for BridgeConfigBuilder
impl Builder for BridgeConfigBuilder
Source§type Built = BridgeConfig
type Built = BridgeConfig
Source§impl Clone for BridgeConfigBuilder
impl Clone for BridgeConfigBuilder
Source§fn clone(&self) -> BridgeConfigBuilder
fn clone(&self) -> BridgeConfigBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BridgeConfigBuilder
impl Debug for BridgeConfigBuilder
Source§impl Default for BridgeConfigBuilder
impl Default for BridgeConfigBuilder
Source§fn default() -> BridgeConfigBuilder
fn default() -> BridgeConfigBuilder
Source§impl<'de> Deserialize<'de> for BridgeConfigBuilder
impl<'de> Deserialize<'de> for BridgeConfigBuilder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<BridgeConfigBuilder> for BridgeConfigBuilderSerde
impl From<BridgeConfigBuilder> for BridgeConfigBuilderSerde
Source§fn from(input: BridgeConfigBuilder) -> BridgeConfigBuilderSerde
fn from(input: BridgeConfigBuilder) -> BridgeConfigBuilderSerde
Source§impl FromStr for BridgeConfigBuilder
BridgeConfigBuilder
parses the same way as BridgeConfig
impl FromStr for BridgeConfigBuilder
BridgeConfigBuilder
parses the same way as BridgeConfig
Source§impl Serialize for BridgeConfigBuilder
impl Serialize for BridgeConfigBuilder
Source§impl TryFrom<BridgeConfigBuilderSerde> for BridgeConfigBuilder
impl TryFrom<BridgeConfigBuilderSerde> for BridgeConfigBuilder
Source§type Error = BridgeParseError
type Error = BridgeParseError
Auto Trait Implementations§
impl Freeze for BridgeConfigBuilder
impl RefUnwindSafe for BridgeConfigBuilder
impl Send for BridgeConfigBuilder
impl Sync for BridgeConfigBuilder
impl Unpin for BridgeConfigBuilder
impl UnwindSafe for BridgeConfigBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§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>
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>
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)
&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)
&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> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§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§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.