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§
source§impl DialOpts
impl DialOpts
sourcepub 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();
sourcepub 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();
sourcepub fn get_peer_id(&self) -> Option<PeerId>
pub fn get_peer_id(&self) -> Option<PeerId>
sourcepub 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§
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> 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> ⓘ
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