pub struct DynamicDir<L, G> { /* private fields */ }Expand description
Helper for the vars/, defs/, procs/-style directories both shell
mounts expose: a readdir that lists live names and a per-name leaf read
(and optional write) sourced from the same backing interpreter.
This is not a [Mount] itself — it’s a pair of async callbacks
(list, get) that a mount’s readdir/read implementations delegate
to for a given subtree, keeping the per-mount glue to a match on
[Fid] kind. See hyprstream-workers-tcl’s vars/procs dirs and
hyprstream-workers-python’s vars/defs dirs for the call sites.
Implementations§
Source§impl<L, G> DynamicDir<L, G>
impl<L, G> DynamicDir<L, G>
Sourcepub fn new(list: L, get: G) -> Self
pub fn new(list: L, get: G) -> Self
Build a dynamic directory from a name-lister and a per-name getter.
The getter returns Result<Option<Vec<u8>>, MountError> (not just
Option<Vec<u8>>) so callers can distinguish a genuine transport/
backend failure (propagated as-is) from “this name doesn’t currently
resolve” (Ok(None), surfaced by DynamicDir::read as
MountError::NotFound) — e.g. a vars/<name> lookup racing an
unset is Ok(None), but the interpreter channel being closed is a
distinct Err.
Sourcepub async fn readdir(&self) -> Vec<DirEntry>
pub async fn readdir(&self) -> Vec<DirEntry>
Mount::readdir for this directory: one flat (non-dir) entry per
live name.
Sourcepub async fn read(&self, name: &str, offset: u64) -> Result<Vec<u8>, MountError>
pub async fn read(&self, name: &str, offset: u64) -> Result<Vec<u8>, MountError>
Mount::read for a <dir>/<name> leaf: fetch and slice from
offset. MountError::NotFound if the name no longer resolves;
any other error from the getter propagates unchanged.
Auto Trait Implementations§
impl<L, G> Freeze for DynamicDir<L, G>
impl<L, G> RefUnwindSafe for DynamicDir<L, G>where
L: RefUnwindSafe,
G: RefUnwindSafe,
impl<L, G> Send for DynamicDir<L, G>
impl<L, G> Sync for DynamicDir<L, G>
impl<L, G> Unpin for DynamicDir<L, G>
impl<L, G> UnsafeUnpin for DynamicDir<L, G>where
L: UnsafeUnpin,
G: UnsafeUnpin,
impl<L, G> UnwindSafe for DynamicDir<L, G>where
L: UnwindSafe,
G: UnwindSafe,
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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