Skip to main content

Backend

Struct Backend 

Source
pub struct Backend { /* private fields */ }
Expand description

One plugin backend (see the module docs). Stops its process when dropped.

Implementations§

Source§

impl Backend

Source

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.

Source

pub fn plugin(&self) -> &str

Source

pub fn wants(&self, event: &str) -> bool

It asked for engine event event.

Source

pub fn status(&self) -> Status

Source

pub fn start(&self)

Start it now if it isn’t running (normally it starts on first use).

Source

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).

Source

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()).

Source

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.

Source

pub fn post(&self, msg: Value)

Hand msg to the sink as if the backend had sent it (the tool host uses this to pass a tool’s card on to the engine).

Source

pub fn stop(&self, why: &str)

Stop the process for good (this object won’t start it again).

Trait Implementations§

Source§

impl Drop for Backend

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.