Trait Browser
pub trait Browser: Send + 'static {
// Required method
fn new(context: BrowserContext) -> Result<Self, ApplicationError>
where Self: Sized;
// Provided methods
fn dispatch(
&mut self,
_command: Command<'_>,
) -> Result<Vec<u8>, CommandError> { ... }
fn shutdown(&mut self) -> Result<(), ApplicationError> { ... }
}Expand description
Stateful backend created only in the browser process.
Command dispatch is serialized on the Rust dispatch worker. Shutdown runs after the backend rejects new commands. Utility children never construct this state or receive its trusted native capabilities.
Required Methods§
fn new(context: BrowserContext) -> Result<Self, ApplicationError>where
Self: Sized,
fn new(context: BrowserContext) -> Result<Self, ApplicationError>where
Self: Sized,
Creates browser state from validated startup configuration.
Provided Methods§
fn dispatch(&mut self, _command: Command<'_>) -> Result<Vec<u8>, CommandError>
fn dispatch(&mut self, _command: Command<'_>) -> Result<Vec<u8>, CommandError>
Handles one binary ShellAPI command.
fn shutdown(&mut self) -> Result<(), ApplicationError>
fn shutdown(&mut self) -> Result<(), ApplicationError>
Cleans up browser state after new dispatches are denied.