Skip to main content

InMemoryExecutionEnv

Struct InMemoryExecutionEnv 

Source
pub struct InMemoryExecutionEnv { /* private fields */ }
Expand description

In-memory ExecutionEnv. Clone shares the underlying state (cheap — the Arc<Mutex<Inner>> is shared).

Implementations§

Source§

impl InMemoryExecutionEnv

Source

pub fn new() -> Self

Source

pub fn with_cwd(cwd: PathBuf) -> Self

Source

pub async fn register_shell( &self, prefix: impl Into<String>, script: ShellScript, )

Register a canned shell result for commands whose start matches prefix. Longest-prefix match wins. Mirrors the faux-provider script pattern.

Source

pub async fn seed_file(&self, abs_path: &str, bytes: Vec<u8>)

Directly seed a file at an absolute path (test setup). Bumps mtime.

Trait Implementations§

Source§

impl Clone for InMemoryExecutionEnv

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for InMemoryExecutionEnv

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ExecutionEnv for InMemoryExecutionEnv

Source§

impl FileSystem for InMemoryExecutionEnv

Source§

fn cwd(&self) -> &Path

The environment’s working directory (absolute).
Source§

fn absolute_path<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<PathBuf, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve path (relative-to-cwd, ~, file://, absolute) to an absolute addressed path. Pure — no FS access, no abort. Mirrors TS absolutePath.
Source§

fn join_path<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, parts: &'life1 [&'life2 str], cancel: Option<&'life3 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<PathBuf, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Join path components. Pure. Mirrors TS joinPath.
Source§

fn read_text_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<String, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn read_text_lines<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, max_lines: Option<usize>, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stream-read up to max_lines lines (split on \n; max_lines <= 0 → empty). Mirrors TS readTextLines{maxLines}.
Source§

fn read_binary_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn write_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, content: FileContent, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<(), FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Creates parent directories (recursive) automatically. Mirrors TS writeFile.
Source§

fn append_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, content: FileContent, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<(), FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn rename_file<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, source: &'life1 str, dest: &'life2 str, cancel: Option<&'life3 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<(), FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn file_info<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<FileInfo, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Uses symlink_metadata (lstat — symlinks not followed). Mirrors TS fileInfo.
Source§

fn list_dir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FileInfo>, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn canonical_path<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<PathBuf, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Follows symlinks (canonicalize). Mirrors TS canonicalPath. Backends may return not_found or not_supported for missing/unsupported paths; callers (mutation queue) fall back to absolute path on those codes.
Source§

fn exists<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<bool, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

false ONLY for not_found; other errors propagate. Mirrors TS exists (which delegates to fileInfo, NOT access(F_OK)).
Source§

fn create_dir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, recursive: bool, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<(), FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Default recursive=true. Mirrors TS createDir{recursive}.
Source§

fn remove<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, recursive: bool, force: bool, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<(), FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Defaults recursive=false, force=false. Mirrors TS remove.
Source§

fn create_temp_dir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prefix: Option<&'life1 str>, cancel: Option<&'life2 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<PathBuf, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Default prefix "tmp-". Mirrors TS createTempDir{prefix}.
Source§

fn create_temp_file<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, prefix: &'life1 str, suffix: &'life2 str, cancel: Option<&'life3 CancellationToken>, ) -> Pin<Box<dyn Future<Output = Result<PathBuf, FileError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Mirrors TS createTempFile{prefix,suffix} (defaults empty). Note: the TS impl creates an isolated temp dir per file; backends may simplify to a single file in the OS temp dir (document any divergence).
Source§

fn cleanup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Best-effort, never returns Err. Mirrors TS cleanup (kills tracked child processes, etc.).
Source§

impl MutatingEnv for InMemoryExecutionEnv

Source§

fn as_env(&self) -> &dyn ExecutionEnv

The underlying ExecutionEnv (for FileSystem/Shell calls).
Source§

fn mutation_registry(&self) -> &MutationQueueRegistry

The registry holding per-canonical-path mutexes.
Source§

impl Shell for InMemoryExecutionEnv

Source§

fn exec<'a, 'life0, 'async_trait>( &'a self, command: &'life0 str, options: ShellExecOptions<'a>, ) -> Pin<Box<dyn Future<Output = Result<ShellOutput, ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Execute command in a bash shell. The TS env resolves a bash binary (git-bash on Windows, /bin/bash on POSIX, /bin/sh fallback on POSIX). There is NO cmd.exe fallback on Windows — failure to find bash is ExecutionError::ShellUnavailable.
Source§

fn cleanup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Best-effort, never returns Err. Mirrors TS Shell.cleanup.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more