Fix: membership comments to documentation (#838)
* rebased * doc comment add * fmt
This commit is contained in:
parent
03854f4c23
commit
b0142d7173
@ -4,25 +4,25 @@ use std::collections::HashSet;
|
|||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
|
|
||||||
pub trait MembershipHandler {
|
pub trait MembershipHandler {
|
||||||
// Subnetworks Id type
|
/// Subnetworks Id type
|
||||||
type NetworkId: Eq + Hash;
|
type NetworkId: Eq + Hash;
|
||||||
|
/// Members Id type
|
||||||
// Members Id type
|
|
||||||
type Id;
|
type Id;
|
||||||
|
|
||||||
// Returns the set of NetworksIds an id is a member of
|
/// Returns the set of NetworksIds an id is a member of
|
||||||
fn membership(&self, id: &Self::Id) -> HashSet<Self::NetworkId>;
|
fn membership(&self, id: &Self::Id) -> HashSet<Self::NetworkId>;
|
||||||
|
|
||||||
// True if the id is a member of a network_id, False otherwise
|
/// True if the id is a member of a network_id, False otherwise
|
||||||
fn is_member_of(&self, id: &Self::Id, network_id: &Self::NetworkId) -> bool {
|
fn is_member_of(&self, id: &Self::Id, network_id: &Self::NetworkId) -> bool {
|
||||||
self.membership(id).contains(network_id)
|
self.membership(id).contains(network_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the member id is in the overall membership set
|
/// Returns true if the member id is in the overall membership set
|
||||||
fn is_allowed(&self, id: &Self::Id) -> bool;
|
fn is_allowed(&self, id: &Self::Id) -> bool;
|
||||||
|
|
||||||
// Returns the set of members in a subnetwork by its NetworkId
|
/// Returns the set of members in a subnetwork by its NetworkId
|
||||||
fn members_of(&self, network_id: &Self::NetworkId) -> HashSet<Self::Id>;
|
fn members_of(&self, network_id: &Self::NetworkId) -> HashSet<Self::Id>;
|
||||||
|
|
||||||
|
/// Returns the set of all members
|
||||||
fn members(&self) -> HashSet<Self::Id>;
|
fn members(&self) -> HashSet<Self::Id>;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user