pub enum EventSelector {
Equals(EventAttribute),
StartsWith(EventAttributePrefix),
And {
left: Box<EventSelector>,
right: Box<EventSelector>,
},
Or {
left: Box<EventSelector>,
right: Box<EventSelector>,
},
}Expand description
A selector for matching events.
Selectors can express equality checks, prefix matching, and logical combinations (AND/OR) of other selectors.
Variants§
Equals(EventAttribute)
Match events where an attribute equals a value.
StartsWith(EventAttributePrefix)
Match events where an attribute starts with a prefix.
And
Match events matching both selectors.
Or
Match events matching either selector.
Implementations§
Source§impl EventSelector
impl EventSelector
Sourcepub fn stream_equals(
stream: impl AsRef<str>,
) -> Result<EventSelector, IdentifierError>
pub fn stream_equals( stream: impl AsRef<str>, ) -> Result<EventSelector, IdentifierError>
Create a selector matching events in a specific stream.
Sourcepub fn subject_equals(
subject: impl AsRef<str>,
) -> Result<EventSelector, IdentifierError>
pub fn subject_equals( subject: impl AsRef<str>, ) -> Result<EventSelector, IdentifierError>
Create a selector matching events with a specific subject.
Sourcepub fn no_subject() -> EventSelector
pub fn no_subject() -> EventSelector
Create a selector matching events with no subject.
Sourcepub fn event_type_equals(
event_type: impl AsRef<str>,
) -> Result<EventSelector, IdentifierError>
pub fn event_type_equals( event_type: impl AsRef<str>, ) -> Result<EventSelector, IdentifierError>
Create a selector matching events of a specific type.
Sourcepub fn stream_starts_with(
prefix: impl AsRef<str>,
) -> Result<EventSelector, IdentifierError>
pub fn stream_starts_with( prefix: impl AsRef<str>, ) -> Result<EventSelector, IdentifierError>
Create a selector matching streams starting with a prefix.
Sourcepub fn subject_starts_with(
prefix: impl AsRef<str>,
) -> Result<EventSelector, IdentifierError>
pub fn subject_starts_with( prefix: impl AsRef<str>, ) -> Result<EventSelector, IdentifierError>
Create a selector matching subjects starting with a prefix.
Sourcepub fn event_type_starts_with(
prefix: impl AsRef<str>,
) -> Result<EventSelector, IdentifierError>
pub fn event_type_starts_with( prefix: impl AsRef<str>, ) -> Result<EventSelector, IdentifierError>
Create a selector matching event types starting with a prefix.
Sourcepub fn and(self, other: EventSelector) -> EventSelector
pub fn and(self, other: EventSelector) -> EventSelector
Combine this selector with another using AND logic.
Sourcepub fn or(self, other: EventSelector) -> EventSelector
pub fn or(self, other: EventSelector) -> EventSelector
Combine this selector with another using OR logic.
Sourcepub fn matches_prospective(&self, event: &ProspectiveEvent) -> bool
pub fn matches_prospective(&self, event: &ProspectiveEvent) -> bool
Check if a prospective event matches this selector.
This is used for client-side filtering of speculated events.
Sourcepub fn matches(&self, event: &Event) -> bool
pub fn matches(&self, event: &Event) -> bool
Check if a stored event matches this selector.
For stored events, the stream is extracted from the source URI.
Sourcepub fn flatten(&self) -> Vec<FlatSelectorNode>
pub fn flatten(&self) -> Vec<FlatSelectorNode>
Flatten this selector tree into an index-based representation.
Returns the list of nodes with the root at the last index. This format is required for WIT transfer since WIT doesn’t support recursive types.
Trait Implementations§
Source§impl Clone for EventSelector
impl Clone for EventSelector
Source§fn clone(&self) -> EventSelector
fn clone(&self) -> EventSelector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventSelector
impl Debug for EventSelector
Source§impl From<EventSelector> for EventSelector
impl From<EventSelector> for EventSelector
Source§fn from(selector: EventSelector) -> Self
fn from(selector: EventSelector) -> Self
Source§impl Hash for EventSelector
impl Hash for EventSelector
Source§impl PartialEq for EventSelector
impl PartialEq for EventSelector
Source§impl TryFrom<EventSelector> for EventSelector
impl TryFrom<EventSelector> for EventSelector
impl Eq for EventSelector
impl StructuralPartialEq for EventSelector
Auto Trait Implementations§
impl Freeze for EventSelector
impl RefUnwindSafe for EventSelector
impl Send for EventSelector
impl Sync for EventSelector
impl Unpin for EventSelector
impl UnwindSafe for EventSelector
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request