pub struct Scheduler { /* private fields */ }Expand description
The live (pre-analysis) text of every open document, with a generation counter per document.
The generation guard is the cancellation model: every edit bumps the generation, and an analysis pass only installs+publishes its result if the generation it captured is still current when it finishes. Stale results are dropped on the floor — no locks held, nothing blocks.
Implementations§
Source§impl Scheduler
impl Scheduler
pub fn new() -> Self
Sourcepub fn open(&self, uri: Url, text: String, version: i32) -> u64
pub fn open(&self, uri: Url, text: String, version: i32) -> u64
Register a newly opened document. Returns its starting generation.
Sourcepub fn apply_changes(
&self,
uri: &Url,
changes: Vec<TextDocumentContentChangeEvent>,
version: i32,
) -> Option<u64>
pub fn apply_changes( &self, uri: &Url, changes: Vec<TextDocumentContentChangeEvent>, version: i32, ) -> Option<u64>
Apply LSP content changes in order and bump the generation.
Returns the new generation, or None for an unopened document.
Sourcepub fn current_if(&self, uri: &Url, generation: u64) -> Option<(String, i32)>
pub fn current_if(&self, uri: &Url, generation: u64) -> Option<(String, i32)>
Snapshot the current text/version if generation is still current.
Sourcepub fn current_text(&self, uri: &Url) -> Option<(String, i32)>
pub fn current_text(&self, uri: &Url) -> Option<(String, i32)>
The live text and version of an open document, regardless of generation — what a save should check.
pub fn is_current(&self, uri: &Url, generation: u64) -> bool
Sourcepub fn open_uris(&self) -> Vec<Url>
pub fn open_uris(&self) -> Vec<Url>
Every open document, for whole-server sweeps (config changes).
pub fn close(&self, uri: &Url)
Auto Trait Implementations§
impl Freeze for Scheduler
impl !RefUnwindSafe for Scheduler
impl Send for Scheduler
impl Sync for Scheduler
impl Unpin for Scheduler
impl UnsafeUnpin for Scheduler
impl UnwindSafe for Scheduler
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.