pub struct ServerId(/* private fields */);Expand description
Unique identity of a configured LSP server within a workspace.
Derived from LspServerConfig::id: a server’s explicit name if set,
otherwise its language_id. This is the key used throughout the bridge
layer (the translator’s server slots, notification receivers)
instead of a raw language string, so two servers sharing a language no
longer silently overwrite each other.
Deserializes from a string and rejects a blank one, so the config file and
Self::new apply the same rule.
§Examples
use mcpls_core::config::ServerId;
assert_eq!(ServerId::new("pyright").unwrap().as_str(), "pyright");
assert!(ServerId::new(" ").is_err());Implementations§
Source§impl ServerId
impl ServerId
Sourcepub const fn from_static(text: &'static str) -> Self
pub const fn from_static(text: &'static str) -> Self
Builds the value from a literal, checked at compile time when
evaluated in a const context.
Accepts only ASCII, non-blank literals, a subset of what
Self::new accepts.
§Panics
Panics if the literal is blank or not ASCII.
§Examples
use mcpls_core::config::ServerId;
const VALUE: ServerId = ServerId::from_static("value");
assert_eq!(VALUE.as_str(), "value");Sourcepub fn new(text: impl Into<String>) -> Result<Self, InvalidServerId>
pub fn new(text: impl Into<String>) -> Result<Self, InvalidServerId>
Builds the value from any string.
§Errors
Returns InvalidServerId if text is blank.
§Examples
use mcpls_core::config::ServerId;
assert!(ServerId::new("value").is_ok());
assert!(ServerId::new(" ").is_err());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>,
impl Eq for ServerId
Source§impl From<LanguageId> for ServerId
impl From<LanguageId> for ServerId
Source§fn from(id: LanguageId) -> Self
fn from(id: LanguageId) -> Self
Source§impl JsonSchema for ServerId
impl JsonSchema for ServerId
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl 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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.