pub struct Backend { /* private fields */ }Expand description
One plugin backend (see the module docs). Stops its process when dropped.
Implementations§
Source§impl Backend
impl Backend
Sourcepub fn new(
plugin: &str,
init: Value,
events: &[String],
prepare: Prepare,
sink: Sink,
) -> Self
pub fn new( plugin: &str, init: Value, events: &[String], prepare: Prepare, sink: Sink, ) -> Self
init is the init message (sent first to every process, with restart added);
events the engine events it gets from the start.
pub fn plugin(&self) -> &str
pub fn status(&self) -> Status
Sourcepub fn event(&self, msg: Value) -> bool
pub fn event(&self, msg: Value) -> bool
Send an event message ({"type": "event", "event": …, …}), starting the backend if
needed. false if it can’t take it (stopped, failed, too big).
Sourcepub fn request(
&self,
method: &str,
params: Value,
timeout: Duration,
cancelled: &dyn Fn() -> bool,
) -> Result<Value, String>
pub fn request( &self, method: &str, params: Value, timeout: Duration, cancelled: &dyn Fn() -> bool, ) -> Result<Value, String>
Ask it something and wait for the reply (or timeout, or cancelled()).
Sourcepub fn report_fault(&self, text: &str)
pub fn report_fault(&self, text: &str)
A problem byob found in what it sent (e.g. a view tree it had to fix): kept in its
status (faults) for the model and the user, and passed to the sink as a fault.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Backend
impl !UnwindSafe for Backend
impl Forget for Backend
impl Freeze for Backend
impl Move for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl UnsafeUnpin for Backend
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
Mutably borrows from an owned value. Read more