pub struct SubscriptionManager { /* private fields */ }Expand description
Manages resource subscriptions for the connected MCP client.
Thread-safe: uses an internal Mutex so it can be shared across async
tasks without requiring &mut self.
Implementations§
Source§impl SubscriptionManager
impl SubscriptionManager
Sourcepub fn subscribe(&self, uri: &str) -> bool
pub fn subscribe(&self, uri: &str) -> bool
Subscribe to a resource URI. Returns true if newly added.
Sourcepub fn unsubscribe(&self, uri: &str) -> bool
pub fn unsubscribe(&self, uri: &str) -> bool
Unsubscribe from a resource URI. Returns true if was present.
Sourcepub fn has_subscriptions(&self) -> bool
pub fn has_subscriptions(&self) -> bool
Check if any subscriptions are registered.
Sourcepub fn affected_subscriptions(&self, mutations: &[MutationKind]) -> Vec<String>
pub fn affected_subscriptions(&self, mutations: &[MutationKind]) -> Vec<String>
Given a set of mutation kinds, return the subscribed URIs that need notification. Only returns URIs that the client has actually subscribed to.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SubscriptionManager
impl RefUnwindSafe for SubscriptionManager
impl Send for SubscriptionManager
impl Sync for SubscriptionManager
impl Unpin for SubscriptionManager
impl UnsafeUnpin for SubscriptionManager
impl UnwindSafe for SubscriptionManager
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> 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