Skip to main content

NumPeersExt

Trait NumPeersExt 

Source
pub trait NumPeersExt {
    // Required method
    fn to_num_peers(&self) -> NumPeers;

    // Provided method
    fn try_num_peers(&self) -> Result<NumPeers, EmptyPeerSet> { ... }
}
Expand description

Types that can be easily converted to NumPeers

Required Methods§

Source

fn to_num_peers(&self) -> NumPeers

Returns the number of guardians in this non-empty collection.

§Panics

Panics if the collection is empty.

Provided Methods§

Source

fn try_num_peers(&self) -> Result<NumPeers, EmptyPeerSet>

Tries to return the number of guardians in this collection.

The default preserves existing implementations of this trait and relies on their nonempty invariant. Implementations that can represent an empty collection must override this method to return EmptyPeerSet.

Implementations on Foreign Types§

Source§

impl NumPeersExt for &[PeerId]

Source§

impl NumPeersExt for BTreeSet<PeerId>

Source§

impl NumPeersExt for Vec<PeerUrl>

Source§

impl NumPeersExt for Vec<PeerId>

Source§

impl<T> NumPeersExt for BTreeMap<PeerId, T>

Implementors§