pub trait NetworkView {
// Required methods
fn listening_as(&self) -> HashSet<Multiaddr>;
fn multiaddress_of(&self, peer: &PeerId) -> Option<HashSet<Multiaddr>>;
fn discovered_peers(&self) -> HashSet<PeerId>;
fn connected_peers(&self) -> HashSet<PeerId>;
fn observations_for<'a>(
&'a self,
peer: &'a PeerId,
) -> Option<impl Observable + 'static>;
fn health(&self) -> Health;
}Expand description
Trait representing a read-only view of the network state.
Required Methods§
Sourcefn listening_as(&self) -> HashSet<Multiaddr>
fn listening_as(&self) -> HashSet<Multiaddr>
Multiaddresses used for listening by the local node.
Sourcefn multiaddress_of(&self, peer: &PeerId) -> Option<HashSet<Multiaddr>>
fn multiaddress_of(&self, peer: &PeerId) -> Option<HashSet<Multiaddr>>
Translation of the peer into its known multiaddresses.
Sourcefn discovered_peers(&self) -> HashSet<PeerId>
fn discovered_peers(&self) -> HashSet<PeerId>
Peers collected by the network discovery mechanism.
Sourcefn connected_peers(&self) -> HashSet<PeerId>
fn connected_peers(&self) -> HashSet<PeerId>
Peers currently connected and tracked by the network.
Sourcefn observations_for<'a>(
&'a self,
peer: &'a PeerId,
) -> Option<impl Observable + 'static>
fn observations_for<'a>( &'a self, peer: &'a PeerId, ) -> Option<impl Observable + 'static>
Observables related to a specific peer in the network.
Returns None if no observations have been recorded for the peer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.