pub struct PatternRules { /* private fields */ }Expand description
PatternRules - Event rule that maps object name patterns to TargetID collections.
event.Rules (map[string]TargetIDSet) in the Go code
Implementations§
Source§impl PatternRules
impl PatternRules
Sourcepub fn add(&mut self, pattern: String, target_id: TargetID)
pub fn add(&mut self, pattern: String, target_id: TargetID)
Add rules: Pattern and Target ID. If the schema already exists, add target_id to the existing TargetIdSet.
§Arguments
pattern- The object name pattern.target_id- The TargetID to associate with the pattern.
Sourcepub fn match_simple(&self, object_name: &str) -> bool
pub fn match_simple(&self, object_name: &str) -> bool
Sourcepub fn match_targets(&self, object_name: &str) -> TargetIdSet
pub fn match_targets(&self, object_name: &str) -> TargetIdSet
Returns all TargetIDs that match the object name.
Performance optimization points:
- Small collections are serialized directly to avoid rayon scheduling/merging overhead
- When hitting, no longer temporarily allocate TargetIdSet for each rule, but directly extend
§Arguments
object_name- The object name to match against the patterns.
§Returns
A TargetIdSet containing all TargetIDs that match the object name.
pub fn is_empty(&self) -> bool
Sourcepub fn difference(&self, other: &Self) -> Self
pub fn difference(&self, other: &Self) -> Self
Sourcepub fn union_in_place(&mut self, other: &Self)
pub fn union_in_place(&mut self, other: &Self)
Merge another PatternRules into self in place.
Corresponding to Go’s Rules.UnionInPlace.
§Arguments
other- The PatternRules to merge with.
Sourcepub fn difference_in_place(&mut self, other: &Self)
pub fn difference_in_place(&mut self, other: &Self)
Calculate the difference from another PatternRules in place.
Corresponding to Go’s Rules.DifferenceInPlace.
The result contains only the patterns and TargetIDs that are in self but not in other.
§Arguments
other- The PatternRules to compare against.
Sourcepub fn remove_pattern(&mut self, pattern: &str) -> bool
pub fn remove_pattern(&mut self, pattern: &str) -> bool
Remove a pattern and its associated TargetID set from the PatternRules.
§Arguments
pattern- The pattern to remove.
Sourcepub fn contains_target_id(&self, target_id: &TargetID) -> bool
pub fn contains_target_id(&self, target_id: &TargetID) -> bool
Trait Implementations§
Source§impl Clone for PatternRules
impl Clone for PatternRules
Source§fn clone(&self) -> PatternRules
fn clone(&self) -> PatternRules
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 PatternRules
impl Debug for PatternRules
Source§impl Default for PatternRules
impl Default for PatternRules
Source§fn default() -> PatternRules
fn default() -> PatternRules
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PatternRules
impl<'de> Deserialize<'de> for PatternRules
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
Auto Trait Implementations§
impl Freeze for PatternRules
impl RefUnwindSafe for PatternRules
impl Send for PatternRules
impl Sync for PatternRules
impl Unpin for PatternRules
impl UnsafeUnpin for PatternRules
impl UnwindSafe for PatternRules
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.