pub trait Labeler: Send + Sync {
// Required methods
fn applies_to(&self, kind: &str) -> bool;
fn apply(&self, res: &mut Resource);
}Expand description
Trait for objects that can label resources based on their attributes.
Implementations should be fast and side-effect free beyond mutating the
provided Resource’s attributes. Repeated application must be safe and
idempotent. A labeler owns the attributes it derives: it must replace or
remove preexisting values instead of trusting caller-provided output.
Required Methods§
Sourcefn applies_to(&self, kind: &str) -> bool
fn applies_to(&self, kind: &str) -> bool
Returns true if this labeler applies to resources of the given kind.
e.g. “Host”, “Database::Table”; you can also support wildcard/globs if you want.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".