pub struct Behavior { /* private fields */ }Implementations§
Trait Implementations§
Source§impl NetworkBehavior for Behavior
impl NetworkBehavior for Behavior
type ConnectionHandler = Handler
type Event = Event
fn on_connection_handler_event( &mut self, id: ConnectionId, peer_id: PeerId, event: THandlerEvent<Self>, )
fn poll( &mut self, _cx: &mut Context<'_>, ) -> Poll<BehaviorEvent<Self::Event, THandlerAction<Self>>>
Source§impl NetworkOutgoingBehavior for Behavior
impl NetworkOutgoingBehavior for Behavior
fn handle_established_connection( &mut self, id: ConnectionId, peer_id: PeerId, addr: &Multiaddr, ) -> Result<Self::ConnectionHandler, ConnectionDenied>
fn handle_pending_connection( &mut self, _id: ConnectionId, _maybe_peer: Option<PeerId>, _addr: &Option<Multiaddr>, ) -> Result<Option<Multiaddr>, ConnectionDenied>
Source§fn on_connection_established(
&mut self,
_id: ConnectionId,
_peer_id: PeerId,
_addr: &Multiaddr,
)
fn on_connection_established( &mut self, _id: ConnectionId, _peer_id: PeerId, _addr: &Multiaddr, )
连接处理器事件处理
fn on_connection_closed( &mut self, _id: ConnectionId, _peer_id: PeerId, _addr: &Multiaddr, _reason: Option<&ConnectionError>, )
Source§fn on_dial_failure(
&mut self,
_id: ConnectionId,
_peer_id: Option<PeerId>,
_addr: Option<&Multiaddr>,
_error: &DialError,
)
fn on_dial_failure( &mut self, _id: ConnectionId, _peer_id: Option<PeerId>, _addr: Option<&Multiaddr>, _error: &DialError, )
失败事件处理
fn poll_dial(&mut self, _cx: &mut Context<'_>) -> Poll<DialOpts>
Auto Trait Implementations§
impl !RefUnwindSafe for Behavior
impl !UnwindSafe for Behavior
impl Freeze for Behavior
impl Send for Behavior
impl Sync for Behavior
impl Unpin for Behavior
impl UnsafeUnpin for Behavior
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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