pub struct LabelsManager { /* private fields */ }Expand description
Manages in-flight label/metadata fetches using promises.
Similar to QueryManager, but for metadata operations like
fetching label names, label values, and metric names.
§Example
ⓘ
let mut manager = LabelsManager::new();
// Fetch all label names
manager.fetch_label_names(&client, &ctx);
// In update loop
if let Some(result) = manager.poll() {
match result {
Ok(labels) => { /* update autocomplete */ }
Err(e) => { /* show error */ }
}
}Implementations§
Source§impl LabelsManager
impl LabelsManager
Sourcepub fn is_fetching(&self) -> bool
pub fn is_fetching(&self) -> bool
Check if a fetch is currently in flight.
Sourcepub fn fetch_label_names<C: MetricsClient + ?Sized>(
&mut self,
client: &C,
ctx: &Context,
)
pub fn fetch_label_names<C: MetricsClient + ?Sized>( &mut self, client: &C, ctx: &Context, )
Fetch all label names from the backend.
If a fetch is already in flight, this does nothing.
Sourcepub fn fetch_label_values<C: MetricsClient + ?Sized>(
&mut self,
client: &C,
label: &str,
ctx: &Context,
)
pub fn fetch_label_values<C: MetricsClient + ?Sized>( &mut self, client: &C, label: &str, ctx: &Context, )
Fetch all values for a specific label.
If a fetch is already in flight, this does nothing.
Sourcepub fn fetch_metric_names<C: MetricsClient + ?Sized>(
&mut self,
client: &C,
ctx: &Context,
)
pub fn fetch_metric_names<C: MetricsClient + ?Sized>( &mut self, client: &C, ctx: &Context, )
Fetch all metric names from the backend.
If a fetch is already in flight, this does nothing.
Sourcepub fn poll(&mut self) -> Option<LabelsResult>
pub fn poll(&mut self) -> Option<LabelsResult>
Poll for the fetch result.
Returns Some(result) if a fetch just completed, None otherwise.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LabelsManager
impl !RefUnwindSafe for LabelsManager
impl Send for LabelsManager
impl !Sync for LabelsManager
impl Unpin for LabelsManager
impl UnsafeUnpin for LabelsManager
impl UnwindSafe for LabelsManager
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