pub struct LanguageId(/* private fields */);Expand description
A non-empty LSP language identifier such as "rust" or "typescript".
Deserializes from a TOML string and rejects an empty one at load time.
§Examples
use mcpls_core::config::LanguageId;
let id = LanguageId::new("rust").unwrap();
assert_eq!(id, "rust");
assert!(LanguageId::new("").is_err());Implementations§
Source§impl LanguageId
impl LanguageId
Source§impl LanguageId
impl LanguageId
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::LanguageId;
const VALUE: LanguageId = LanguageId::from_static("value");
assert_eq!(VALUE.as_str(), "value");Sourcepub fn new(text: impl Into<String>) -> Result<Self, InvalidLanguageId>
pub fn new(text: impl Into<String>) -> Result<Self, InvalidLanguageId>
Builds the value from any string.
§Errors
Returns InvalidLanguageId if text is blank.
§Examples
use mcpls_core::config::LanguageId;
assert!(LanguageId::new("value").is_ok());
assert!(LanguageId::new(" ").is_err());Trait Implementations§
Source§impl AsRef<str> for LanguageId
impl AsRef<str> for LanguageId
Source§impl Borrow<str> for LanguageId
impl Borrow<str> for LanguageId
Source§impl Clone for LanguageId
impl Clone for LanguageId
Source§impl Debug for LanguageId
impl Debug for LanguageId
Source§impl<'de> Deserialize<'de> for LanguageId
impl<'de> Deserialize<'de> for LanguageId
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
Source§impl Display for LanguageId
impl Display for LanguageId
impl Eq for LanguageId
Source§impl From<LanguageId> for String
impl From<LanguageId> for String
Source§fn from(value: LanguageId) -> Self
fn from(value: LanguageId) -> Self
Converts to this type from the input type.
Source§impl From<LanguageId> for ServerId
impl From<LanguageId> for ServerId
Source§fn from(id: LanguageId) -> Self
fn from(id: LanguageId) -> Self
Converts to this type from the input type.
Source§impl FromStr for LanguageId
impl FromStr for LanguageId
Source§impl Hash for LanguageId
impl Hash for LanguageId
Source§impl JsonSchema for LanguageId
impl JsonSchema for LanguageId
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§impl Ord for LanguageId
impl Ord for LanguageId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for LanguageId
impl PartialEq for LanguageId
Source§impl PartialEq<&str> for LanguageId
impl PartialEq<&str> for LanguageId
Source§impl PartialEq<str> for LanguageId
impl PartialEq<str> for LanguageId
Source§impl PartialOrd for LanguageId
impl PartialOrd for LanguageId
Source§impl Serialize for LanguageId
impl Serialize for LanguageId
impl StructuralPartialEq for LanguageId
Auto Trait Implementations§
impl Freeze for LanguageId
impl RefUnwindSafe for LanguageId
impl Send for LanguageId
impl Sync for LanguageId
impl Unpin for LanguageId
impl UnsafeUnpin for LanguageId
impl UnwindSafe for LanguageId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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
Compare self to
key and return true if they are equal.