Struct swarm_nl::core::DefaultHandler

source ·
pub struct DefaultHandler;
Expand description

Default network event handler.

Trait Implementations§

source§

impl Clone for DefaultHandler

source§

fn clone(&self) -> DefaultHandler

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl EventHandler for DefaultHandler

source§

fn rpc_incoming_message_handled(&mut self, data: Vec<Vec<u8>>) -> Vec<Vec<u8>>

Echo the message back to the sender.

source§

fn gossipsub_incoming_message_handled( &mut self, _source: PeerId, _data: Vec<String> )

Echo the incoming gossip message to the console.

source§

fn new_listen_addr( &mut self, _local_peer_id: PeerId, _listener_id: ListenerId, _addr: Multiaddr )

Event that informs the application that we have started listening on a new multiaddr.
source§

fn routing_table_updated(&mut self, _peer_id: PeerId)

Event that informs the application that a new peer (with its location details) has just been added to the routing table.
source§

fn connection_established( &mut self, _peer_id: PeerId, _connection_id: ConnectionId, _endpoint: &ConnectedPoint, _num_established: NonZeroU32, _established_in: Duration )

Event that informs the application about a newly established connection to a peer.
source§

fn connection_closed( &mut self, _peer_id: PeerId, _connection_id: ConnectionId, _endpoint: &ConnectedPoint, _num_established: u32, _cause: Option<ConnectionError> )

Event that informs the application about a closed connection to a peer.
source§

fn expired_listen_addr(&mut self, _listener_id: ListenerId, _address: Multiaddr)

Event that announces expired listen address.
source§

fn listener_closed( &mut self, _listener_id: ListenerId, _addresses: Vec<Multiaddr> )

Event that announces a closed listener.
source§

fn listener_error(&mut self, _listener_id: ListenerId)

Event that announces a listener error.
source§

fn dialing(&mut self, _peer_id: Option<PeerId>, _connection_id: ConnectionId)

Event that announces a dialing attempt.
source§

fn new_external_addr_candidate(&mut self, _address: Multiaddr)

Event that announces a new external address candidate.
source§

fn external_addr_confirmed(&mut self, _address: Multiaddr)

Event that announces a confirmed external address.
source§

fn external_addr_expired(&mut self, _address: Multiaddr)

Event that announces an expired external address.
source§

fn incoming_connection( &mut self, _connection_id: ConnectionId, _local_addr: Multiaddr, _send_back_addr: Multiaddr )

Event that announces new connection arriving on a listener and in the process of protocol negotiation.
source§

fn incoming_connection_error( &mut self, _connection_id: ConnectionId, _local_addr: Multiaddr, _send_back_addr: Multiaddr )

Event that announces an error happening on an inbound connection during its initial handshake.
source§

fn outgoing_connection_error( &mut self, _connection_id: ConnectionId, _peer_id: Option<PeerId> )

Event that announces an error happening on an outbound connection during its initial handshake.
source§

fn outbound_ping_success(&mut self, _peer_id: PeerId, _duration: Duration)

Event that announces the arrival of a pong message from a peer. The duration it took for a round trip is also returned.
source§

fn outbound_ping_error(&mut self, _peer_id: PeerId, _err_type: Failure)

Event that announces a Ping error.
source§

fn identify_info_recieved(&mut self, _peer_id: PeerId, _info: Info)

Event that announces the arrival of a PeerInfo via the Identify protocol.
source§

fn kademlia_put_record_success(&mut self, _key: Vec<u8>)

Event that announces the successful write of a record to the DHT.
source§

fn kademlia_put_record_error(&mut self)

Event that announces the failure of a node to save a record.
source§

fn kademlia_start_providing_success(&mut self, _key: Vec<u8>)

Event that announces a node as a provider of a record in the DHT.
source§

fn kademlia_start_providing_error(&mut self)

Event that announces the failure of a node to become a provider of a record in the DHT.
source§

fn gossipsub_unsubscribe_message_recieved( &mut self, _peer_id: PeerId, _topic: String )

Event that announces that a peer has just left a network.
source§

fn gossipsub_subscribe_message_recieved( &mut self, _peer_id: PeerId, _topic: String )

Event that announces that a peer has just joined a network.
source§

fn gossipsub_incoming_message_filtered( &mut self, _propagation_source: PeerId, _message_id: MessageId, _source: Option<PeerId>, _topic: String, _data: Vec<String> ) -> bool

Event that announces the beginning of the filtering and authentication of the incoming gossip message. It returns a boolean to specify whether the massage should be dropped or should reach the application. All incoming messages are allowed in by default.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more