Struct distant_core::LspData
source · [−]pub struct LspData { /* private fields */ }Expand description
Represents some data being communicated to/from an LSP consisting of a header and content part
Implementations
sourceimpl LspData
impl LspData
sourcepub fn mut_header(&mut self) -> &mut LspHeader
pub fn mut_header(&mut self) -> &mut LspHeader
Returns a mutable reference to the header part
sourcepub fn content(&self) -> &LspContent
pub fn content(&self) -> &LspContent
Returns a reference to the content part
sourcepub fn mut_content(&mut self) -> &mut LspContent
pub fn mut_content(&mut self) -> &mut LspContent
Returns a mutable reference to the content part
sourcepub fn refresh_content_length(&mut self)
pub fn refresh_content_length(&mut self)
Updates the header content length based on the current content
sourcepub fn take_session_info(&mut self) -> Result<SessionInfo, LspSessionInfoError>
pub fn take_session_info(&mut self) -> Result<SessionInfo, LspSessionInfoError>
Creates a session’s info by inspecting the content for session parameters, removing the session parameters from the content. Will also adjust the content length header to match the new size of the content.
sourcepub fn from_buf_reader<R: BufRead>(r: &mut R) -> Result<Self, LspDataParseError>
pub fn from_buf_reader<R: BufRead>(r: &mut R) -> Result<Self, LspDataParseError>
Attempts to read incoming lsp data from a buffered reader.
Note that this is blocking while it waits on the header information (or EOF)!
Content-Length: ...\r\n
Content-Type: ...\r\n
\r\n
{
"jsonrpc": "2.0",
...
}Trait Implementations
sourceimpl<'de> Deserialize<'de> for LspData
impl<'de> Deserialize<'de> for LspData
sourcefn 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 LspData
impl StructuralEq for LspData
impl StructuralPartialEq for LspData
Auto Trait Implementations
impl RefUnwindSafe for LspData
impl Send for LspData
impl Sync for LspData
impl Unpin for LspData
impl UnwindSafe for LspData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more