pub struct ServerBuilder<T: Transport> { /* private fields */ }
Implementations§
Source§impl<T: Transport> ServerBuilder<T>
impl<T: Transport> ServerBuilder<T>
pub fn name<S: Into<String>>(self, name: S) -> Self
pub fn version<S: Into<String>>(self, version: S) -> Self
pub fn capabilities(self, capabilities: ServerCapabilities) -> Self
Sourcepub fn request_handler<Req, Resp>(
self,
method: &str,
handler: impl Fn(Req) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send>> + Send + Sync + 'static,
) -> Self
pub fn request_handler<Req, Resp>( self, method: &str, handler: impl Fn(Req) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send>> + Send + Sync + 'static, ) -> Self
Register a typed request handler for higher-level api use add tool
pub fn notification_handler<N>( self, method: &str, handler: impl Fn(N) -> Pin<Box<dyn Future<Output = Result<()>> + Send>> + Send + Sync + 'static, ) -> Self
pub fn register_tool( &mut self, tool: Tool, f: impl Fn(CallToolRequest) -> Pin<Box<dyn Future<Output = Result<CallToolResponse>> + Send>> + Send + Sync + 'static, )
pub fn build(self) -> Server<T>
Auto Trait Implementations§
impl<T> Freeze for ServerBuilder<T>where
T: Freeze,
impl<T> !RefUnwindSafe for ServerBuilder<T>
impl<T> Send for ServerBuilder<T>
impl<T> Sync for ServerBuilder<T>
impl<T> Unpin for ServerBuilder<T>where
T: Unpin,
impl<T> !UnwindSafe for ServerBuilder<T>
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