pub struct App { /* private fields */ }Expand description
Builder for a fude application.
Implementations§
Source§impl App
impl App
Sourcepub fn new(identifier: impl Into<String>) -> Self
pub fn new(identifier: impl Into<String>) -> Self
Create a new app. identifier is a reverse-DNS string used to locate
the config / data directory (e.g. "com.example.editor").
pub fn title(self, title: impl Into<String>) -> Self
Sourcepub fn assets(self, root: impl Into<PathBuf>) -> Self
pub fn assets(self, root: impl Into<PathBuf>) -> Self
Directory served as the root of asset://localhost/. Typically
your Vite/webpack dist/ output.
Sourcepub fn command<F>(self, name: impl Into<String>, handler: F) -> Self
pub fn command<F>(self, name: impl Into<String>, handler: F) -> Self
Register a custom IPC command.
Sourcepub fn with_fs_sandbox(self) -> Self
pub fn with_fs_sandbox(self) -> Self
Register the built-in allow-list FS commands:
allow_path, allow_dir, list_directory, read_file,
read_file_binary, write_file, write_file_binary, ensure_dir.
The frontend must call allow_path / allow_dir after a native
dialog selection — no file I/O is permitted until then.
Sourcepub fn with_settings(self) -> Self
pub fn with_settings(self) -> Self
Register load_settings / save_settings — persist an arbitrary
JSON object at <app_config_dir>/settings.json via
crate::atomic_write.
load_settings() returns the parsed object, or {} if none saved.
save_settings({ settings: {...} }) writes atomically. The
payload must be a JSON object; arrays / scalars are rejected.
Sourcepub fn with_shell_open(self) -> Self
pub fn with_shell_open(self) -> Self
Register shell_open — opens URLs (http/https/mailto) or
allow-listed local file paths in the OS default application.
File-path targets require App::with_fs_sandbox and must
already be in the allow-list (via a dialog or manual allow_path).
Sourcepub fn with_dialogs(self) -> Self
pub fn with_dialogs(self) -> Self
Register native dialog commands: dialog_open, dialog_save,
dialog_ask, dialog_message.
Sourcepub fn with_pty(self, allowed_tools: &[&str]) -> Self
pub fn with_pty(self, allowed_tools: &[&str]) -> Self
Register PTY commands for spawning CLI agents (e.g. claude, codex).
Registers: pty_spawn, pty_write, pty_resize, pty_kill and
emits pty:data / pty:exit events.
allowed_tools is the only set of binaries that may ever be spawned;
anything else is rejected. Requires App::with_fs_sandbox to have
been called — the PTY cwd must live inside an allow-listed directory.
Sourcepub fn with_acp(
self,
adapters: Vec<AcpAdapterConfig>,
client_name: impl Into<String>,
client_version: impl Into<String>,
) -> Self
pub fn with_acp( self, adapters: Vec<AcpAdapterConfig>, client_name: impl Into<String>, client_version: impl Into<String>, ) -> Self
Register ACP (Agent Client Protocol) commands.
Registers 11 acp_* commands. Requires App::with_fs_sandbox — the
agent’s fs/read_text_file / fs/write_text_file calls are
intercepted and reject anything outside the user’s allow-list.
Auto Trait Implementations§
impl Freeze for App
impl !RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnsafeUnpin for App
impl !UnwindSafe for App
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.