#[non_exhaustive]pub struct MetricRule {
pub selector: String,
pub metric_costs: HashMap<String, i64>,
/* private fields */
}
Expand description
Bind API methods to metrics. Binding a method to a metric causes that metric’s configured quota behaviors to apply to the method call.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.selector: String
Selects the methods to which this rule applies.
Refer to selector for syntax details.
metric_costs: HashMap<String, i64>
Metrics to update when the selected methods are called, and the associated cost applied to each metric.
The key of the map is the metric name, and the values are the amount increased for the metric against which the quota limits are defined. The value must not be negative.
Implementations§
Source§impl MetricRule
impl MetricRule
pub fn new() -> Self
Sourcepub fn set_selector<T: Into<String>>(self, v: T) -> Self
pub fn set_selector<T: Into<String>>(self, v: T) -> Self
Sets the value of selector.
Sourcepub fn set_metric_costs<T, K, V>(self, v: T) -> Self
pub fn set_metric_costs<T, K, V>(self, v: T) -> Self
Sets the value of metric_costs.
Trait Implementations§
Source§impl Clone for MetricRule
impl Clone for MetricRule
Source§fn clone(&self) -> MetricRule
fn clone(&self) -> MetricRule
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 moreSource§impl Debug for MetricRule
impl Debug for MetricRule
Source§impl Default for MetricRule
impl Default for MetricRule
Source§fn default() -> MetricRule
fn default() -> MetricRule
Returns the “default value” for a type. Read more
Source§impl PartialEq for MetricRule
impl PartialEq for MetricRule
impl StructuralPartialEq for MetricRule
Auto Trait Implementations§
impl Freeze for MetricRule
impl RefUnwindSafe for MetricRule
impl Send for MetricRule
impl Sync for MetricRule
impl Unpin for MetricRule
impl UnwindSafe for MetricRule
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