Skip to content

Commit be5c7a1

Browse files
committed
chore: add #[non_exhaustive] to remaining public types
1 parent 1ab088f commit be5c7a1

17 files changed

Lines changed: 47 additions & 0 deletions

File tree

crates/rmcp/src/handler/server/prompt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ impl<T: IntoGetPromptResult> IntoGetPromptResult for Result<T, crate::ErrorData>
118118
// Future wrapper that automatically handles IntoGetPromptResult conversion
119119
pin_project_lite::pin_project! {
120120
#[project = IntoGetPromptResultFutProj]
121+
#[non_exhaustive]
121122
pub enum IntoGetPromptResultFut<F, R> {
122123
Pending {
123124
#[pin]

crates/rmcp/src/handler/server/router.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::{
1313
pub mod prompt;
1414
pub mod tool;
1515

16+
#[non_exhaustive]
1617
pub struct Router<S> {
1718
pub tool_router: tool::ToolRouter<S>,
1819
pub prompt_router: prompt::PromptRouter<S>,

crates/rmcp/src/handler/server/router/prompt.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::{
66
service::{MaybeBoxFuture, MaybeSend},
77
};
88

9+
#[non_exhaustive]
910
pub struct PromptRoute<S> {
1011
#[allow(clippy::type_complexity)]
1112
pub get: Arc<DynGetPromptHandler<S>>,
@@ -103,6 +104,7 @@ where
103104
}
104105

105106
#[derive(Debug)]
107+
#[non_exhaustive]
106108
pub struct PromptRouter<S> {
107109
#[allow(clippy::type_complexity)]
108110
pub map: std::collections::HashMap<Cow<'static, str>, PromptRoute<S>>,

crates/rmcp/src/handler/server/router/tool.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ use crate::{
136136
service::{MaybeBoxFuture, MaybeSend},
137137
};
138138

139+
#[non_exhaustive]
139140
pub struct ToolRoute<S> {
140141
#[allow(clippy::type_complexity)]
141142
pub call: Arc<DynCallToolHandler<S>>,
@@ -251,6 +252,7 @@ where
251252
}
252253
}
253254

255+
#[non_exhaustive]
254256
pub struct WithToolAttr<C, S, A>
255257
where
256258
C: CallToolHandler<S, A> + MaybeSend + Clone + 'static,
@@ -292,6 +294,7 @@ where
292294
}
293295
}
294296
#[derive(Debug)]
297+
#[non_exhaustive]
295298
pub struct ToolRouter<S> {
296299
#[allow(clippy::type_complexity)]
297300
pub map: std::collections::HashMap<Cow<'static, str>, ToolRoute<S>>,

crates/rmcp/src/handler/server/tool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ impl<T: IntoCallToolResult> IntoCallToolResult for Result<T, crate::ErrorData> {
105105

106106
pin_project_lite::pin_project! {
107107
#[project = IntoCallToolResultFutProj]
108+
#[non_exhaustive]
108109
pub enum IntoCallToolResultFut<F, R> {
109110
Pending {
110111
#[pin]

crates/rmcp/src/service/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ macro_rules! elicit_safe {
571571
}
572572

573573
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
574+
#[non_exhaustive]
574575
pub enum ElicitationMode {
575576
Form,
576577
Url,

crates/rmcp/src/task_manager.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub type OperationFuture =
1919

2020
/// Describes metadata associated with an enqueued task.
2121
#[derive(Debug, Clone)]
22+
#[non_exhaustive]
2223
pub struct OperationDescriptor {
2324
pub operation_id: String,
2425
pub name: String,
@@ -55,6 +56,7 @@ impl OperationDescriptor {
5556
}
5657

5758
/// Operation message describing a unit of asynchronous work.
59+
#[non_exhaustive]
5860
pub struct OperationMessage {
5961
pub descriptor: OperationDescriptor,
6062
pub future: OperationFuture,
@@ -91,6 +93,7 @@ struct RunningTask {
9193
descriptor: OperationDescriptor,
9294
}
9395

96+
#[non_exhaustive]
9497
pub struct TaskResult {
9598
pub descriptor: OperationDescriptor,
9699
pub result: Result<Box<dyn OperationResultTransport>, Error>,

crates/rmcp/src/transport.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ where
151151
fn into_transport(self) -> impl Transport<R, Error = E> + 'static;
152152
}
153153

154+
#[non_exhaustive]
154155
pub enum TransportAdapterIdentity {}
155156
impl<R, T, E> IntoTransport<R, E, TransportAdapterIdentity> for T
156157
where
@@ -231,6 +232,7 @@ where
231232

232233
#[derive(Debug, thiserror::Error)]
233234
#[error("Transport [{transport_name}] error: {error}")]
235+
#[non_exhaustive]
234236
pub struct DynamicTransportError {
235237
pub transport_name: Cow<'static, str>,
236238
pub transport_type_id: std::any::TypeId,

crates/rmcp/src/transport/async_rw.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use tokio_util::{
1616
use super::{IntoTransport, Transport};
1717
use crate::service::{RxJsonRpcMessage, ServiceRole, TxJsonRpcMessage};
1818

19+
#[non_exhaustive]
1920
pub enum TransportAdapterAsyncRW {}
2021

2122
impl<Role, R, W> IntoTransport<Role, std::io::Error, TransportAdapterAsyncRW> for (R, W)
@@ -29,6 +30,7 @@ where
2930
}
3031
}
3132

33+
#[non_exhaustive]
3234
pub enum TransportAdapterAsyncCombinedRW {}
3335
impl<Role, S> IntoTransport<Role, std::io::Error, TransportAdapterAsyncCombinedRW> for S
3436
where
@@ -277,6 +279,7 @@ fn try_parse_with_compatibility<T: serde::de::DeserializeOwned>(
277279
}
278280

279281
#[derive(Debug, Error)]
282+
#[non_exhaustive]
280283
pub enum JsonRpcMessageCodecError {
281284
#[error("max line length exceeded")]
282285
MaxLineLengthExceeded,

crates/rmcp/src/transport/auth.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ impl std::fmt::Debug for StoredAuthorizationState {
174174
/// }
175175
/// ```
176176
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
177+
#[non_exhaustive]
177178
pub struct VendorExtraTokenFields(pub HashMap<String, Value>);
178179

179180
impl ExtraTokenFields for VendorExtraTokenFields {}
@@ -467,6 +468,7 @@ pub const EXTENSION_OAUTH_CLIENT_CREDENTIALS: &str =
467468
/// JWT signing algorithm for private_key_jwt authentication (SEP-1046)
468469
#[cfg(feature = "auth-client-credentials-jwt")]
469470
#[derive(Debug, Clone, Copy)]
471+
#[non_exhaustive]
470472
pub enum JwtSigningAlgorithm {
471473
RS256,
472474
RS384,
@@ -504,6 +506,7 @@ impl JwtSigningAlgorithm {
504506
/// - `ClientSecret`: credentials sent in the request body
505507
/// - `PrivateKeyJwt`: RFC 7523 signed JWT assertion (requires `auth-client-credentials-jwt` feature)
506508
#[derive(Debug, Clone)]
509+
#[non_exhaustive]
507510
pub enum ClientCredentialsConfig {
508511
/// Client secret authentication (credentials in request body)
509512
ClientSecret {
@@ -607,6 +610,7 @@ pub(crate) struct ClientRegistrationRequest {
607610
}
608611

609612
#[derive(Debug, Clone, Serialize, Deserialize)]
613+
#[non_exhaustive]
610614
pub struct ClientRegistrationResponse {
611615
pub client_id: String,
612616
pub client_secret: Option<String>,
@@ -2043,6 +2047,7 @@ impl AuthorizationManager {
20432047
}
20442048

20452049
/// oauth2 authorization session, for guiding user to complete the authorization process
2050+
#[non_exhaustive]
20462051
pub struct AuthorizationSession {
20472052
pub auth_manager: AuthorizationManager,
20482053
pub auth_url: String,
@@ -2195,6 +2200,7 @@ impl AuthorizedHttpClient {
21952200
/// OAuth state machine
21962201
/// Use the OAuthState to manage the OAuth client is more recommend
21972202
/// But also you can use the AuthorizationManager,AuthorizationSession,AuthorizedHttpClient directly
2203+
#[non_exhaustive]
21982204
pub enum OAuthState {
21992205
/// the AuthorizationManager
22002206
Unauthorized(AuthorizationManager),

0 commit comments

Comments
 (0)