pub trait Label: Sized {
// Required methods
fn with_current_labels(self) -> Labeled<Self> ⓘ;
fn with_label<K, V>(self, k: K, v: V) -> Labeled<Self> ⓘ
where K: AsRef<[u8]>,
V: AsRef<[u8]>;
fn with_labels<I, K, V>(self, i: I) -> Labeled<Self> ⓘ
where I: IntoIterator<Item = (K, V)>,
K: AsRef<[u8]>,
V: AsRef<[u8]>;
fn with_labelset(self, labelset: Labelset) -> Labeled<Self> ⓘ;
}Expand description
Attaches custom labels to a Future.
Required Methods§
Sourcefn with_current_labels(self) -> Labeled<Self> ⓘ
fn with_current_labels(self) -> Labeled<Self> ⓘ
Attach the currently active labels to the future.
This can be used to propagate the current labels when spawning a new future.
Sourcefn with_label<K, V>(self, k: K, v: V) -> Labeled<Self> ⓘ
fn with_label<K, V>(self, k: K, v: V) -> Labeled<Self> ⓘ
Attach a single label to the future.
This is equivalent to calling [with_labels] with an iterator that
yields a single key–value pair.
Sourcefn with_labels<I, K, V>(self, i: I) -> Labeled<Self> ⓘ
fn with_labels<I, K, V>(self, i: I) -> Labeled<Self> ⓘ
Attaches the specified labels to the future.
The labels will be installed in the current thread whenever the future is polled, and removed when the poll completes.
This is equivalent to calling [with_labelset] with a label
set constructed like so:
let mut labelset = Labelset::clone_from_current();
labelset.extend(i);Sourcefn with_labelset(self, labelset: Labelset) -> Labeled<Self> ⓘ
fn with_labelset(self, labelset: Labelset) -> Labeled<Self> ⓘ
Attaches the specified labelset to the future.
The labels in the set will be installed in the current thread whenever the future is polled, and removed when the poll completes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.