* chore: add #[non_exhaustive] to reduce backwards-incompatible changes going forward * fix: remove ProtocolVersion import * fix: add a few more with_ mutator methods --------- Co-authored-by: Alex Hancock <alexhancock@block.xyz>
31 lines
973 B
Rust
31 lines
973 B
Rust
// cargo test --test test_handler_wrappers --features "client server"
|
|
|
|
mod common;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use common::handlers::TestServer;
|
|
use rmcp::ServerHandler;
|
|
|
|
#[test]
|
|
fn test_wrapped_server_handlers() {
|
|
// This test asserts that, when T: ServerHandler, both Box<T> and Arc<T> also implement ServerHandler.
|
|
fn accepts_server_handler<H: ServerHandler>(_handler: H) {}
|
|
|
|
accepts_server_handler(Box::new(TestServer::new()));
|
|
accepts_server_handler(Arc::new(TestServer::new()));
|
|
}
|
|
|
|
#[cfg(feature = "client")]
|
|
#[test]
|
|
fn test_wrapped_client_handlers() {
|
|
use common::handlers::TestClientHandler;
|
|
use rmcp::ClientHandler;
|
|
// This test asserts that, when T: ClientHandler, both Box<T> and Arc<T> also implement ClientHandler.
|
|
fn accepts_client_handler<H: ClientHandler>(_handler: H) {}
|
|
|
|
let client = TestClientHandler::new(false, false);
|
|
|
|
accepts_client_handler(Box::new(client.clone()));
|
|
accepts_client_handler(Arc::new(client));
|
|
}
|