pub struct TabSize(/* private fields */);Expand description
The tab size a formatting request asks the server for: 1 to
MAX_TAB_SIZE, 4 by default.
Deserializes from a JSON integer and rejects out-of-range values as
invalid params, so an unbounded u32 never reaches a language server.
§Examples
use mcpls_core::bridge::{InvalidTabSize, MAX_TAB_SIZE, TabSize};
assert_eq!(TabSize::default().get(), 4);
assert_eq!(TabSize::try_from(MAX_TAB_SIZE)?.get(), MAX_TAB_SIZE);
assert_eq!(TabSize::try_from(0), Err(InvalidTabSize(0)));
assert_eq!(TabSize::try_from(MAX_TAB_SIZE + 1), Err(InvalidTabSize(MAX_TAB_SIZE + 1)));Implementations§
Trait Implementations§
impl Copy for TabSize
Source§impl<'de> Deserialize<'de> for TabSize
impl<'de> Deserialize<'de> for TabSize
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 TabSize
Source§impl JsonSchema for TabSize
impl JsonSchema for TabSize
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
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 moreimpl StructuralPartialEq for TabSize
Auto Trait Implementations§
impl Freeze for TabSize
impl RefUnwindSafe for TabSize
impl Send for TabSize
impl Sync for TabSize
impl Unpin for TabSize
impl UnsafeUnpin for TabSize
impl UnwindSafe for TabSize
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,
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.