pub struct shfunc_table { /* private fields */ }Expand description
Shell function hash table
$shfunctab shell function table.
Port of the shfunctab HashTable Src/hashtable.c builds —
printshfuncnode / freeshfuncnode (Src/builtin.c) hang off
the same shape.
Faithful port of C’s HashTable shfunctab (Src/zsh.h, declared
mod_export HashTable shfunctab). Stores Box<shfunc> so that
raw *mut shfunc handed to C-style call sites stays stable
across map rehashes — mirrors C’s HashNode semantics where
the table owns the heap allocation and hands out pointers.
Owned-value accessors (add, get, get_mut) coexist with
C-faithful pointer accessors (addnode, getnode) so both
the Rust-idiomatic bytecode function-def path
(fusevm_bridge.rs:8378) and the C-style bin_functions
port (builtin.rs:3689+) write to the same canonical table.
Implementations§
Source§impl shfunc_table
impl shfunc_table
Sourcepub fn snapshot(&self) -> HashMap<String, Box<shfunc>>
pub fn snapshot(&self) -> HashMap<String, Box<shfunc>>
snapshot — clone the internal HashMap<String, Box<shfunc>>
for subshell save/restore. Used by subshell_begin to capture
the parent’s function set before the subshell body runs, so
subshell_end can restore it (matches C fork-copy semantics
at Src/exec.c::entersubsh).
Sourcepub fn restore(&mut self, snap: HashMap<String, Box<shfunc>>)
pub fn restore(&mut self, snap: HashMap<String, Box<shfunc>>)
restore — replace the internal table with a saved snapshot.
Called by subshell_end after the subshell body completes.
Sourcepub fn get_including_disabled(&self, name: &str) -> Option<&shfunc>
pub fn get_including_disabled(&self, name: &str) -> Option<&shfunc>
get_including_disabled — see implementation.
Sourcepub fn contains_key(&self, name: &str) -> bool
pub fn contains_key(&self, name: &str) -> bool
contains_key — see implementation.
Sourcepub fn addnode(&mut self, shf: *mut shfunc)
pub fn addnode(&mut self, shf: *mut shfunc)
Port of C’s HashTable.addnode GSU function pointer
(Src/zsh.h:281+). Takes a *mut shfunc (typedef Shfunc)
previously obtained via Box::into_raw — reclaims ownership
into the table by name. After this call, the caller’s shf
pointer is INVALIDATED in the Rust ownership sense; subsequent
reads must go through getnode(name) to get a fresh pointer.
In practice, C code re-uses the same shf pointer because the
Box stays at the same heap address — we keep that semantic by
boxing-on-heap. Replaces any prior entry with the same name
(matching C addnode’s overwrite-and-free-old behavior).
Sourcepub fn getnode(&self, name: &str) -> *mut shfunc
pub fn getnode(&self, name: &str) -> *mut shfunc
Port of C’s HashTable.getnode GSU. Returns the raw Shfunc
pointer (typedef *mut shfunc) or null if missing or disabled.
Pointer stays valid as long as the underlying Box<shfunc>
lives in the table (i.e. until remove/addnode-overwrite).
Sourcepub fn getnode2(&self, name: &str) -> *mut shfunc
pub fn getnode2(&self, name: &str) -> *mut shfunc
Port of C’s HashTable.getnode2 GSU — same as getnode but
returns disabled nodes too. Used by unhash/enable -f paths.
Sourcepub fn iter_sorted(&self) -> Vec<(&String, &shfunc)>
pub fn iter_sorted(&self) -> Vec<(&String, &shfunc)>
iter_sorted — see implementation.
Trait Implementations§
Source§impl Debug for shfunc_table
impl Debug for shfunc_table
Auto Trait Implementations§
impl Freeze for shfunc_table
impl RefUnwindSafe for shfunc_table
impl Send for shfunc_table
impl Sync for shfunc_table
impl Unpin for shfunc_table
impl UnsafeUnpin for shfunc_table
impl UnwindSafe for shfunc_table
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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