pub struct LabelsBuilder { /* private fields */ }
Expand description
Builder for Labels
Implementations§
Source§impl LabelsBuilder
impl LabelsBuilder
Sourcepub fn new(names: Vec<&str>) -> LabelsBuilder
pub fn new(names: Vec<&str>) -> LabelsBuilder
Create a new empty LabelsBuilder
with the given names
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserve space for additional
other entries in the labels.
Sourcepub fn add<T>(&mut self, entry: &[T])
pub fn add<T>(&mut self, entry: &[T])
Add a single entry
to this set of labels.
This function will panic when attempting to add the same label
more
than once.
Sourcepub fn finish(self) -> Labels
pub fn finish(self) -> Labels
Finish building the Labels
.
This function checks that all entries in the labels are unique.
Sourcepub fn finish_assume_unique(self) -> Labels
pub fn finish_assume_unique(self) -> Labels
Finish building the Labels
, assuming that all entries are unique.
This is faster than finish
as it does not perform a uniqueness check
on the labels entries. It is the caller’s responsibility to ensure that
entries are unique.
§Panics
If the set of names is not valid (contains duplicates or invalid names).
Trait Implementations§
Source§impl Clone for LabelsBuilder
impl Clone for LabelsBuilder
Source§fn clone(&self) -> LabelsBuilder
fn clone(&self) -> LabelsBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for LabelsBuilder
impl RefUnwindSafe for LabelsBuilder
impl Send for LabelsBuilder
impl Sync for LabelsBuilder
impl Unpin for LabelsBuilder
impl UnwindSafe for LabelsBuilder
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