pub struct ProgressSchema { /* private fields */ }Expand description
Metric dictionary for one logical progress operation.
A schema defines which metric ids are valid for the operation. Events carry a schema so every serialized progress event is self-describing and reporters can resolve metric ids to display names without external state.
Implementations§
Source§impl ProgressSchema
impl ProgressSchema
Sourcepub fn new(metrics: Vec<ProgressMetric>) -> Self
pub fn new(metrics: Vec<ProgressMetric>) -> Self
Sourcepub fn metrics(&self) -> &[ProgressMetric]
pub fn metrics(&self) -> &[ProgressMetric]
Sourcepub fn metric(&self, id: &str) -> Option<&ProgressMetric>
pub fn metric(&self, id: &str) -> Option<&ProgressMetric>
Sourcepub fn metric_name(&self, id: &str) -> Option<&str>
pub fn metric_name(&self, id: &str) -> Option<&str>
Sourcepub fn contains_metric(&self, id: &str) -> bool
pub fn contains_metric(&self, id: &str) -> bool
Sourcepub fn validate_counter(&self, counter: &ProgressCounter) -> bool
pub fn validate_counter(&self, counter: &ProgressCounter) -> bool
Sourcepub fn validate_counters(&self, counters: &[ProgressCounter]) -> bool
pub fn validate_counters(&self, counters: &[ProgressCounter]) -> bool
Validates counters against this schema.
Validation is intentionally light-weight: every counter metric id must exist in the schema and each metric id may appear at most once in the event. Numeric relationships are not validated because many operations discover totals dynamically or apply retry and compensation logic.
§Parameters
counters- Counters to validate.
§Returns
true when all counters reference declared metrics and no metric id is
duplicated.
Trait Implementations§
Source§impl Clone for ProgressSchema
impl Clone for ProgressSchema
Source§fn clone(&self) -> ProgressSchema
fn clone(&self) -> ProgressSchema
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProgressSchema
impl Debug for ProgressSchema
Source§impl Default for ProgressSchema
impl Default for ProgressSchema
Source§impl<'de> Deserialize<'de> for ProgressSchema
impl<'de> Deserialize<'de> for ProgressSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ProgressSchema
impl PartialEq for ProgressSchema
Source§fn eq(&self, other: &ProgressSchema) -> bool
fn eq(&self, other: &ProgressSchema) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ProgressSchema
impl Serialize for ProgressSchema
impl Eq for ProgressSchema
impl StructuralPartialEq for ProgressSchema
Auto Trait Implementations§
impl Freeze for ProgressSchema
impl RefUnwindSafe for ProgressSchema
impl Send for ProgressSchema
impl Sync for ProgressSchema
impl Unpin for ProgressSchema
impl UnsafeUnpin for ProgressSchema
impl UnwindSafe for ProgressSchema
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