pub struct Engine { /* private fields */ }Implementations§
Source§impl Engine
impl Engine
Sourcepub fn new(workspace: Workspace, languages: LanguageRegistry) -> Self
pub fn new(workspace: Workspace, languages: LanguageRegistry) -> Self
An engine over workspace that understands languages. Reads the
tree afresh for every graph-dependent request unless
Engine::with_retention says otherwise.
Sourcepub fn with_retention(self, retention: Retention) -> Self
pub fn with_retention(self, retention: Retention) -> Self
Keep files and facts between commands (Retention::Session) or
read the workspace afresh each time (the default).
Sourcepub fn run(&self, request: Request) -> Result<Execution, EngineError>
pub fn run(&self, request: Request) -> Result<Execution, EngineError>
Run one request under operation exclusion. Acquire the graph only for capabilities that need source-tree facts; retain mutation plans until the caller applies them or converts the execution to a wire answer. A typed query goes through its capability method, not this dispatcher:
use vvv_engine::{Engine, Languages, MemoryVfs, Query, Workspace};
use std::sync::Arc;
let engine = Engine::new(Workspace::new("/ws", Arc::new(MemoryVfs::new())), Languages::new());
engine.run(Query::pattern("foo"));Sourcepub fn with_oracle(self, oracle: Arc<dyn Oracle>) -> Self
pub fn with_oracle(self, oracle: Arc<dyn Oracle>) -> Self
Ask oracle about the tokens syntax cannot place — a build, a
language server, an index the host has. The graph judges every token
by imports first; the oracle is consulted only where that says ?,
and its answer counts only when it names a declaration the graph
knows.
Sourcepub fn touched(&self)
pub fn touched(&self)
Tell a session the tree changed behind its back — an editor wrote, say — so its next command walks even within the trusted window.
Sourcepub fn language_ids(&self) -> Vec<LanguageId>
pub fn language_ids(&self) -> Vec<LanguageId>
The languages this engine understands.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Freeze for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more