pub struct TextDocumentCache { /* private fields */ }Expand description
Cache of the client’s open documents, mirroring the didOpen/didClose lifecycle: didOpen is the only way in, didClose the only way out. That makes the size exactly the client’s open-document count — bounded by the protocol, with no eviction that could orphan a still-open document.
Implementations§
Source§impl TextDocumentCache
impl TextDocumentCache
pub fn get(&self, uri: &str) -> Option<TextDocumentCacheItem>
pub fn insert(&self, document: &TextDocumentItem)
Sourcepub fn update(&self, uri: &Url, text: &str, version: Option<i32>)
pub fn update(&self, uri: &Url, text: &str, version: Option<i32>)
Update an open document’s text. version replaces the stored version
when Some (didChange); None keeps the existing one (didSave, which
carries no version). Updates for documents the client never opened are
dropped — inserting here would create entries no didClose removes.
pub fn remove(&self, uri: &Url)
pub fn cached_urls(&self) -> Vec<Url>
Trait Implementations§
Source§impl Debug for TextDocumentCache
impl Debug for TextDocumentCache
Source§impl Default for TextDocumentCache
impl Default for TextDocumentCache
Source§fn default() -> TextDocumentCache
fn default() -> TextDocumentCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for TextDocumentCache
impl RefUnwindSafe for TextDocumentCache
impl Send for TextDocumentCache
impl Sync for TextDocumentCache
impl Unpin for TextDocumentCache
impl UnsafeUnpin for TextDocumentCache
impl UnwindSafe for TextDocumentCache
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