Skip to main content

NativeBackend

Trait NativeBackend 

Source
pub trait NativeBackend: Send {
    // Required method
    fn request(
        &mut self,
        method: &str,
        params: &Value,
        out: &Outbox,
    ) -> Result<Value, String>;

    // Provided methods
    fn init(&mut self, init: &Value, out: &Outbox) { ... }
    fn event(&mut self, event: &Value, out: &Outbox) { ... }
    fn after_request(&mut self, method: &str, out: &Outbox) { ... }
    fn shutdown(&mut self) { ... }
}
Expand description

A plugin backend in byob’s process (see the module docs). Calls come one at a time, in order, on the backend’s own thread.

Required Methods§

Source

fn request( &mut self, method: &str, params: &Value, out: &Outbox, ) -> Result<Value, String>

A request (method: tool, view, hook, web): its reply’s result, or the error text. Messages sent through out meanwhile reach byob before the reply.

Provided Methods§

Source

fn init(&mut self, init: &Value, out: &Outbox)

The init message: first after every (re)start (restart counts earlier starts).

Source

fn event(&mut self, event: &Value, out: &Outbox)

An event (event: client, view, web, or a subscribed engine event).

Source

fn after_request(&mut self, method: &str, out: &Outbox)

After the reply to a request went out (e.g. draw views again after a tool call).

Source

fn shutdown(&mut self)

shutdown: byob stops it (reload, switched off, removed); nothing more comes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§