Expand description
High-level, in-process helpers for crates that embed this one as a library.
Sibling hosts such as zpwrchrome-host depend on zwire-host to crawl the
filesystem and run commands without speaking the wire protocol or
standing up a daemon — they just call these functions and get native Rust
values back:
// in zpwrchrome-host:
for entry in zwire_host::api::walk("~/src", Some("rs")) {
println!("{}", entry.path.display());
}
let out = zwire_host::api::exec("git", ["status", "--porcelain"]).unwrap();
println!("git exited {:?}:\n{}", out.code, String::from_utf8_lossy(&out.stdout));Everything here is a thin, allocation-light wrapper over the same capability functions the transports call, so behaviour is identical in-process and over the socket.
Structs§
- Entry
- One node found by
walk. - Exec
Output - Captured result of
exec.
Functions§
- exec
- Run
program args...to completion in-process and capture its output. Errors carry the failure reason (e.g. the program was not found). - exec_
stdin - Run
programwithinputfed to its stdin. - read_
file - Read a whole file (
~-expandable path) into bytes. - theme_
get - The current shared theme as
(scheme, ui), whereuiis the light/fx object. - theme_
set_ scheme - Set the shared colour scheme: persist to
global.toml(+ thehud-schemeprojection) and notify every local subscriber + peer so the fleet follows. - theme_
set_ ui - Merge a partial light/fx object (e.g.
{"light":true}) into the shared ui and notify subscribers + peers. Returns the merged ui. - theme_
watch - Watch the shared theme for changes and invoke
on_change(scheme, ui)— once immediately (so the caller converges to the current value) and thereafter wheneverglobal.tomlchanges, from this app or any other. Spawns a background thread and returns at once. An app backend uses this to push live theme updates into its UI (emit a Tauri/JUCEtheme-changedevent). - walk
- Recursively crawl
root(a~-expandable path).ext, when given, keeps only files with that extension (no leading dot). Capped internally so a crawl of a huge tree can’t run away. - walk_
filtered - Like
walkbut with the full filter set:depth,dirs_only,ext,contains(substring match on the leaf name). - write_
file - Write bytes to a file (
~-expandable path), creating parent dirs.