pub struct InMemoryTopicRegistry { /* private fields */ }Expand description
Registry for subscription topics.
Stores topic definitions and evaluates which topics match a given resource event.
Implementations§
Source§impl InMemoryTopicRegistry
impl InMemoryTopicRegistry
Sourcepub fn add_topic(&self, topic: TopicDefinition)
pub fn add_topic(&self, topic: TopicDefinition)
Registers a topic definition.
Sourcepub fn remove_topic(&self, canonical_url: &str) -> bool
pub fn remove_topic(&self, canonical_url: &str) -> bool
Removes a topic by canonical URL.
Sourcepub fn list_topics(&self) -> Vec<String>
pub fn list_topics(&self) -> Vec<String>
Returns all registered topic canonical URLs.
Sourcepub fn get_topic(&self, canonical_url: &str) -> Option<TopicDefinition>
pub fn get_topic(&self, canonical_url: &str) -> Option<TopicDefinition>
Returns a topic definition by canonical URL.
Sourcepub fn matching_topics(
&self,
resource_type: &str,
event_type: ResourceEventType,
) -> Vec<TopicMatch>
pub fn matching_topics( &self, resource_type: &str, event_type: ResourceEventType, ) -> Vec<TopicMatch>
Evaluates which topics match a resource event.
Checks all registered topics’ resource triggers against the event’s resource type and interaction type.
Sourcepub fn parse_topic_resource(
resource: &Value,
) -> Result<TopicDefinition, SubscriptionError>
pub fn parse_topic_resource( resource: &Value, ) -> Result<TopicDefinition, SubscriptionError>
Parses a SubscriptionTopic FHIR resource (JSON) into a TopicDefinition.
Works for R4B, R5, and R6 native SubscriptionTopic resources.
Sourcepub fn parse_r4_backport_basic_topic_resource(
resource: &Value,
) -> Result<Option<TopicDefinition>, SubscriptionError>
pub fn parse_r4_backport_basic_topic_resource( resource: &Value, ) -> Result<Option<TopicDefinition>, SubscriptionError>
Parses an R4 backport Basic topic into a TopicDefinition.
Returns:
Ok(Some(topic))when the resource is a strict backport topicOk(None)when the resource isBasicbut not a topicErrwhen the resource is marked as a topic but malformed
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for InMemoryTopicRegistry
impl RefUnwindSafe for InMemoryTopicRegistry
impl Send for InMemoryTopicRegistry
impl Sync for InMemoryTopicRegistry
impl Unpin for InMemoryTopicRegistry
impl UnsafeUnpin for InMemoryTopicRegistry
impl UnwindSafe for InMemoryTopicRegistry
Blanket Implementations§
impl<T> Allocation for T
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> 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