Struct DialOpts
pub struct DialOpts { /* private fields */ }
Expand description
Options to configure a dial to a known or unknown peer.
Used in Swarm::dial
and
ToSwarm::Dial
.
To construct use either of:
-
DialOpts::peer_id
dialing a known peer -
DialOpts::unknown_peer_id
dialing an unknown peer
Implementations§
§impl DialOpts
impl DialOpts
pub fn peer_id(peer_id: PeerId) -> WithPeerId
pub fn peer_id(peer_id: PeerId) -> WithPeerId
Dial a known peer.
DialOpts::peer_id(PeerId::random())
.condition(PeerCondition::Disconnected)
.addresses(vec!["/ip6/::1/tcp/12345".parse().unwrap()])
.extend_addresses_through_behaviour()
.build();
pub fn unknown_peer_id() -> WithoutPeerId
pub fn unknown_peer_id() -> WithoutPeerId
Dial an unknown peer.
DialOpts::unknown_peer_id()
.address("/ip6/::1/tcp/12345".parse().unwrap())
.build();
pub fn get_peer_id(&self) -> Option<PeerId>
pub fn get_peer_id(&self) -> Option<PeerId>
pub fn connection_id(&self) -> ConnectionId
pub fn connection_id(&self) -> ConnectionId
Get the ConnectionId
of this dial attempt.
All future events of this dial will be associated with this ID.
See DialFailure
and
ConnectionEstablished
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DialOpts
impl RefUnwindSafe for DialOpts
impl Send for DialOpts
impl Sync for DialOpts
impl Unpin for DialOpts
impl UnwindSafe for DialOpts
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> 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,
§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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