pub struct Context<'cx, T = ()> {
pub storage: &'cx Storage,
pub data: T,
/* private fields */
}Expand description
The context is the most important part of incremental compilation, the structure through which queries are run and that caches query invocations.
Fields§
§storage: &'cx Storage§data: TImplementations§
Source§impl<'cx, T> Context<'cx, T>
impl<'cx, T> Context<'cx, T>
pub fn with_data(storage: &'cx Storage, data: T) -> Self
pub fn set_cache_enabled(&self, enabled: bool)
pub fn next_generation(&self)
Sourcepub fn gc(self, new_storage: &Storage) -> Context<'_, T>
pub fn gc(self, new_storage: &Storage) -> Context<'_, T>
Garbage collect the context. Deletes unreachable notes. Reachability is evaluated based on “root” nodes.
Some queries are run as part of another query in the query system,
I like to call those queries that run “inside” the query system.
Other queries are run from “outside” the query system after you
created a new Context and want to run your first query.
These outside queries are considered root queries, and any node reachable
from them is kept alive by gc.
After this, all objects are allocated in new_storage and you can delete
the old backing storage to actually save space.
Trait Implementations§
Auto Trait Implementations§
impl<'cx, T = ()> !Freeze for Context<'cx, T>
impl<'cx, T = ()> !RefUnwindSafe for Context<'cx, T>
impl<'cx, T = ()> !Send for Context<'cx, T>
impl<'cx, T = ()> !Sync for Context<'cx, T>
impl<'cx, T> Unpin for Context<'cx, T>where
T: Unpin,
impl<'cx, T = ()> !UnwindSafe for Context<'cx, T>
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