Struct ParticipantLabels
pub struct ParticipantLabels { /* private fields */ }Expand description
The numbers a workspace’s participants are told apart by, resolved once from its roster and read for each label shown. Cheap to rebuild whenever the roster changes.
Implementations§
§impl ParticipantLabels
impl ParticipantLabels
pub fn new<'a>(
people: impl IntoIterator<Item = (&'a str, &'a str)>,
) -> ParticipantLabels
pub fn new<'a>( people: impl IntoIterator<Item = (&'a str, &'a str)>, ) -> ParticipantLabels
Resolve the numbers for people, each an (id, name) pair. Order
does not matter, and a repeated id counts once (its last name). A
blank name collides with nothing: it is shown as whatever stands in
for it.
pub fn by_joining<'a>(
people: impl IntoIterator<Item = (&'a str, &'a str, Option<u64>)>,
) -> ParticipantLabels
pub fn by_joining<'a>( people: impl IntoIterator<Item = (&'a str, &'a str, Option<u64>)>, ) -> ParticipantLabels
Self::new for people as (id, name, joined), joined being
when the workspace admitted them (any unit every replica shares, such as
the admission’s Unix time). Whoever joined first is numbered first;
those the workspace has no time for follow, by id.
pub fn number(&self, id: &str) -> Option<usize>
pub fn number(&self, id: &str) -> Option<usize>
The number id is told apart by, when their name collides.
pub fn label(&self, id: &str, name: &str) -> String
pub fn label(&self, id: &str, name: &str) -> String
name as id is shown: “Ada (2)” when the workspace has more than one
Ada, name itself otherwise. The number is only added while name
is still the one that collided, so a caller holding a newer name than
the roster’s never shows a number that belongs to the old one.
Trait Implementations§
§impl Clone for ParticipantLabels
impl Clone for ParticipantLabels
§fn clone(&self) -> ParticipantLabels
fn clone(&self) -> ParticipantLabels
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ParticipantLabels
impl Debug for ParticipantLabels
§impl Default for ParticipantLabels
impl Default for ParticipantLabels
§fn default() -> ParticipantLabels
fn default() -> ParticipantLabels
§impl PartialEq for ParticipantLabels
impl PartialEq for ParticipantLabels
§fn eq(&self, other: &ParticipantLabels) -> bool
fn eq(&self, other: &ParticipantLabels) -> bool
self and other values to be equal, and is used by ==.impl Eq for ParticipantLabels
impl StructuralPartialEq for ParticipantLabels
Auto Trait Implementations§
impl Freeze for ParticipantLabels
impl RefUnwindSafe for ParticipantLabels
impl Send for ParticipantLabels
impl Sync for ParticipantLabels
impl Unpin for ParticipantLabels
impl UnsafeUnpin for ParticipantLabels
impl UnwindSafe for ParticipantLabels
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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