pub struct CapabilitiesNegotiator { /* private fields */ }Expand description
Per-member set of advertised capability tokens.
Implementations§
Source§impl CapabilitiesNegotiator
impl CapabilitiesNegotiator
Sourcepub fn advertise<I, S>(&mut self, member: MemberId, capabilities: I)
pub fn advertise<I, S>(&mut self, member: MemberId, capabilities: I)
Records an advertisement. Replaces any prior advertisement from the same member.
Sourcepub fn forget(&mut self, member: MemberId)
pub fn forget(&mut self, member: MemberId)
Removes a member’s advertisement (e.g. after LEAVE).
Sourcepub fn capabilities_of(&self, member: MemberId) -> Option<&BTreeSet<String>>
pub fn capabilities_of(&self, member: MemberId) -> Option<&BTreeSet<String>>
Returns the current advertisement for member.
Sourcepub fn group_supports(&self, cap: &str) -> bool
pub fn group_supports(&self, cap: &str) -> bool
true if every advertised member supports cap.
Sourcepub fn intersection(&self) -> BTreeSet<String>
pub fn intersection(&self) -> BTreeSet<String>
Returns the intersection — capabilities that every member advertises, i.e. the safe-to-use set.
Sourcepub fn union(&self) -> BTreeSet<String>
pub fn union(&self) -> BTreeSet<String>
Returns the union — every capability advertised by any member.
Sourcepub fn missing(&self, cap: &str) -> Vec<MemberId> ⓘ
pub fn missing(&self, cap: &str) -> Vec<MemberId> ⓘ
Returns the members that did not advertise cap.
Sourcepub fn reset_for_epoch(&mut self)
pub fn reset_for_epoch(&mut self)
Clears all advertisements. Call on epoch advance for symmetry with
[GapClient::sync_epoch], [GtpClient::sync_epoch] and
[GspClient::sync_epoch].
Trait Implementations§
Source§impl Default for CapabilitiesNegotiator
impl Default for CapabilitiesNegotiator
Source§fn default() -> CapabilitiesNegotiator
fn default() -> CapabilitiesNegotiator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CapabilitiesNegotiator
impl RefUnwindSafe for CapabilitiesNegotiator
impl Send for CapabilitiesNegotiator
impl Sync for CapabilitiesNegotiator
impl Unpin for CapabilitiesNegotiator
impl UnsafeUnpin for CapabilitiesNegotiator
impl UnwindSafe for CapabilitiesNegotiator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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