NotificationBuilder

Struct NotificationBuilder 

Source
pub struct NotificationBuilder { /* private fields */ }
Expand description

Builder for creating notifications at runtime

Implementations§

Source§

impl NotificationBuilder

Source

pub fn new(method: impl Into<String>) -> Self

Create a new notification builder with the given method

Source

pub fn params(self, params: NotificationParams) -> Self

Set notification parameters

Source

pub fn param(self, key: impl Into<String>, value: Value) -> Self

Add a parameter to the notification

Source

pub fn meta(self, meta: HashMap<String, Value>) -> Self

Set meta information

Source

pub fn meta_value(self, key: impl Into<String>, value: Value) -> Self

Add a meta key-value pair

Source

pub fn priority(self, priority: u32) -> Self

Set notification priority (higher = more important)

Source

pub fn can_batch(self, can_batch: bool) -> Self

Set whether this notification can be batched with others

Source

pub fn max_retries(self, max_retries: u32) -> Self

Set maximum retry attempts

Source

pub fn build(self) -> Notification

Build the notification

Source

pub fn build_dynamic(self) -> DynamicNotification

Build a dynamic notification that implements the definition traits

Source§

impl NotificationBuilder

Convenience methods for common notification patterns

Source

pub fn resource_list_changed() -> ResourceListChangedNotification

Create a resource list changed notification

Source

pub fn tool_list_changed() -> ToolListChangedNotification

Create a tool list changed notification

Source

pub fn prompt_list_changed() -> PromptListChangedNotification

Create a prompt list changed notification

Source

pub fn roots_list_changed() -> RootsListChangedNotification

Create a roots list changed notification

Source

pub fn initialized() -> InitializedNotification

Create an initialized notification

Source

pub fn progress( progress_token: impl Into<String>, progress: u64, ) -> ProgressNotificationBuilder

Create a progress notification builder

Source

pub fn resource_updated( uri: impl Into<String>, ) -> ResourceUpdatedNotificationBuilder

Create a resource updated notification builder

Source

pub fn cancelled(request_id: RequestId) -> CancelledNotificationBuilder

Create a cancelled notification builder

Source

pub fn logging_message( level: LoggingLevel, data: Value, ) -> LoggingMessageNotification

Create a logging message notification builder

Source

pub fn custom(method: impl Into<String>) -> Self

Create a custom notification

Source

pub fn server_notification(method: impl Into<String>) -> Self

Create a server-to-client notification

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.