Skip to main content

ExecutionContext

Struct ExecutionContext 

Source
pub struct ExecutionContext<'a> {
    pub workspace_root: &'a Path,
    pub registry: &'a SymbolRegistry,
    pub graph: &'a CodeGraphV2,
    pub files: ImHashMap<WorkspaceFilePath, Arc<PureFile>>,
}
Expand description

Context for parallel Mutation execution.

Created by AnalysisContext::fork(). Shares Registry and Graph as read-only references, with Files using O(log n) structural sharing.

§Design

AnalysisContext (owner)
├── workspace_root: Arc<Path>   │
├── registry: SymbolRegistry  ──┤
├── graph: CodeGraphV2         │  shared (read-only)
└── files: im::HashMap<...>    │
                                │
ExecutionContext<'a>            │
├── workspace_root: &'a Path     ←┘
├── registry: &'a SymbolRegistry ←┘
├── graph: &'a CodeGraphV2      ←┘
└── files: im::HashMap<...>  (O(log n) clone, copy-on-write)

§Performance

  • Clone: O(log n) via im::HashMap structural sharing
  • Modification: Copy-on-write via Arc::make_mut

§Collecting Changes

Mutations return RegistryUpdate deltas instead of modifying Registry directly. These are collected and applied to AnalysisContext at Tick end.

See docs/parallel-execution-design.md for the full design.

Fields§

§workspace_root: &'a Path

Read-only reference to workspace root.

§registry: &'a SymbolRegistry

Read-only reference to SymbolRegistry.

Mutations should collect changes as RegistryUpdate instead of modifying directly.

§graph: &'a CodeGraphV2

Read-only reference to CodeGraphV2.

§files: ImHashMap<WorkspaceFilePath, Arc<PureFile>>

Files with O(log n) clone via structural sharing.

Uses im::HashMap<WorkspaceFilePath, Arc<PureFile>> for:

  • O(log n) clone (structural sharing)
  • Copy-on-write modification via Arc::make_mut

Implementations§

Source§

impl<'a> ExecutionContext<'a>

Source

pub fn file(&self, path: &WorkspaceFilePath) -> Option<&PureFile>

Get a file by path.

Source

pub fn file_mut(&mut self, path: &WorkspaceFilePath) -> Option<&mut PureFile>

Get a mutable file by path (copy-on-write).

Uses Arc::make_mut for copy-on-write semantics:

  • If Arc is uniquely owned, returns mutable reference directly
  • If Arc is shared, clones the PureFile first
Source

pub fn has_file(&self, path: &WorkspaceFilePath) -> bool

Check if a file exists.

Source

pub fn file_count(&self) -> usize

Get the number of files.

Auto Trait Implementations§

§

impl<'a> Freeze for ExecutionContext<'a>

§

impl<'a> RefUnwindSafe for ExecutionContext<'a>

§

impl<'a> Send for ExecutionContext<'a>

§

impl<'a> Sync for ExecutionContext<'a>

§

impl<'a> Unpin for ExecutionContext<'a>

§

impl<'a> UnsafeUnpin for ExecutionContext<'a>

§

impl<'a> UnwindSafe for ExecutionContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.