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§
Sourcefn to_num_peers(&self) -> NumPeers
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§
Sourcefn try_num_peers(&self) -> Result<NumPeers, EmptyPeerSet>
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.