pub struct ServerId(/* private fields */);Expand description
Server identifier (newtype over String).
Represents a unique identifier for an MCP server. Using a strong type prevents accidentally mixing server IDs with other string values.
§Examples
use mcp_execution_core::ServerId;
let id = ServerId::new("example-server");
assert_eq!(id.as_str(), "example-server");Implementations§
Source§impl ServerId
impl ServerId
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Creates a new server identifier.
§Examples
use mcp_execution_core::ServerId;
let id = ServerId::new("my-server");
let from_string = ServerId::new(String::from("my-server"));
assert_eq!(id, from_string);Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the server ID as a string slice.
§Examples
use mcp_execution_core::ServerId;
let id = ServerId::new("test");
assert_eq!(id.as_str(), "test");Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consumes the ServerId and returns the inner String.
§Examples
use mcp_execution_core::ServerId;
let id = ServerId::new("test");
let inner: String = id.into_inner();
assert_eq!(inner, "test");Trait Implementations§
Source§impl<'de> Deserialize<'de> for ServerId
impl<'de> Deserialize<'de> for ServerId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ServerId
impl StructuralPartialEq for ServerId
Auto Trait Implementations§
impl Freeze for ServerId
impl RefUnwindSafe for ServerId
impl Send for ServerId
impl Sync for ServerId
impl Unpin for ServerId
impl UnwindSafe for ServerId
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