Skip to content

Commit f77d9e6

Browse files
committed
fix: compilation with --no-default-features
1 parent 95d3e3f commit f77d9e6

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

crates/rmcp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ chrono = { version = "0.4.38", default-features = false, features = [
7777
[features]
7878
default = ["base64", "macros", "server"]
7979
client = ["dep:tokio-stream"]
80-
server = ["transport-async-rw", "dep:schemars"]
80+
server = ["transport-async-rw", "dep:schemars", "dep:pastey"]
8181
macros = ["dep:rmcp-macros", "dep:pastey"]
8282
elicitation = []
8383

crates/rmcp/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::{borrow::Cow, fmt::Display};
22

3-
use crate::ServiceError;
43
pub use crate::model::ErrorData;
54
#[deprecated(
65
note = "Use `rmcp::ErrorData` instead, `rmcp::ErrorData` could become `RmcpError` in the future."
@@ -22,8 +21,9 @@ impl std::error::Error for ErrorData {}
2221
#[derive(Debug, thiserror::Error)]
2322
#[allow(clippy::large_enum_variant)]
2423
pub enum RmcpError {
24+
#[cfg(any(feature = "client", feature = "server"))]
2525
#[error("Service error: {0}")]
26-
Service(#[from] ServiceError),
26+
Service(#[from] crate::ServiceError),
2727
#[cfg(feature = "client")]
2828
#[error("Client initialization error: {0}")]
2929
ClientInitialize(#[from] crate::service::ClientInitializeError),

crates/rmcp/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ pub use pastey::paste;
178178
#[cfg(all(feature = "macros", feature = "server"))]
179179
#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))]
180180
pub use rmcp_macros::*;
181-
#[cfg(all(feature = "macros", feature = "server"))]
182-
#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))]
181+
#[cfg(any(feature = "macros", feature = "server"))]
182+
#[cfg_attr(docsrs, doc(cfg(any(feature = "macros", feature = "server"))))]
183183
pub use schemars;
184184
#[cfg(feature = "macros")]
185185
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]

crates/rmcp/src/model/prompt.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
use base64::engine::{Engine, general_purpose::STANDARD as BASE64_STANDARD};
21
use serde::{Deserialize, Serialize};
32

43
use super::{
5-
AnnotateAble, Annotations, Icon, Meta, RawEmbeddedResource, RawImageContent,
4+
AnnotateAble, Annotations, Icon, Meta, RawEmbeddedResource,
65
content::{EmbeddedResource, ImageContent},
76
resource::ResourceContents,
87
};
@@ -138,11 +137,13 @@ impl PromptMessage {
138137
meta: Option<crate::model::Meta>,
139138
annotations: Option<Annotations>,
140139
) -> Self {
140+
use base64::{Engine, prelude::BASE64_STANDARD};
141+
141142
let base64 = BASE64_STANDARD.encode(data);
142143
Self {
143144
role,
144145
content: PromptMessageContent::Image {
145-
image: RawImageContent {
146+
image: crate::model::RawImageContent {
146147
data: base64,
147148
mime_type: mime_type.into(),
148149
meta,
@@ -215,7 +216,7 @@ mod tests {
215216

216217
#[test]
217218
fn test_prompt_message_image_serialization() {
218-
let image_content = RawImageContent {
219+
let image_content = crate::model::RawImageContent {
219220
data: "base64data".to_string(),
220221
mime_type: "image/png".to_string(),
221222
meta: None,

0 commit comments

Comments
 (0)