pub struct CapabilitiesNegotiator { /* private fields */ }Expand description
Per-member set of advertised capability tokens.
Implementations§
Source§impl CapabilitiesNegotiator
impl CapabilitiesNegotiator
Sourcepub fn new() -> CapabilitiesNegotiator
pub fn new() -> CapabilitiesNegotiator
Empty negotiator (no member has advertised anything yet).
Sourcepub fn advertise<I, S>(&mut self, member: u32, capabilities: I)
pub fn advertise<I, S>(&mut self, member: u32, capabilities: I)
Records an advertisement. Replaces any prior advertisement from the same member.
Sourcepub fn capabilities_of(&self, member: u32) -> Option<&BTreeSet<String>>
pub fn capabilities_of(&self, member: u32) -> 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 declare_class(&mut self, member: u32, class: ConformanceClass)
pub fn declare_class(&mut self, member: u32, class: ConformanceClass)
Declares the conformance class for member by inserting the
appropriate well-known tokens (gbp-interop-profile §2).
Each higher class implies the lower ones, so Class C inserts tokens for A, B and C. Tokens are merged with any existing capabilities for that member.
Sourcepub fn group_class(&self) -> Option<ConformanceClass>
pub fn group_class(&self) -> Option<ConformanceClass>
Returns the highest ConformanceClass that every member in the
negotiation supports, or None if no member has advertised any class.
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
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
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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