pub struct RegexLabeler { /* private fields */ }Expand description
A labeler that uses regular expressions for matching on resource attributes.
Implementations§
Source§impl RegexLabeler
impl RegexLabeler
Sourcepub fn new(
kind: impl Into<String>,
field: impl Into<String>,
output: impl Into<String>,
table: Vec<(String, Regex)>,
) -> Self
pub fn new( kind: impl Into<String>, field: impl Into<String>, output: impl Into<String>, table: Vec<(String, Regex)>, ) -> Self
Create a regex-based labeler.
kind: resource kind this applies to (e.g., “Host”)field: attribute to read from (e.g., “name”)output: attribute to write labels to (e.g., “nameLabels”)table: vector of(label, regex)pairs
Configure field and output as distinct attributes so repeated
application remains idempotent. field reads the resource attribute
map; it does not expose canonical entity fields. In particular, an
attribute named id is not the canonical Resource::id value during
labeling. Use a custom Labeler that reads Resource::id when
labels must derive from the resource identity.
Trait Implementations§
Source§impl Clone for RegexLabeler
impl Clone for RegexLabeler
Source§fn clone(&self) -> RegexLabeler
fn clone(&self) -> RegexLabeler
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 RegexLabeler
impl Debug for RegexLabeler
Auto Trait Implementations§
impl Freeze for RegexLabeler
impl RefUnwindSafe for RegexLabeler
impl Send for RegexLabeler
impl Sync for RegexLabeler
impl Unpin for RegexLabeler
impl UnsafeUnpin for RegexLabeler
impl UnwindSafe for RegexLabeler
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more