Skip to main content

DaemonHarness

Struct DaemonHarness 

Source
pub struct DaemonHarness<P: DaemonPlugin> { /* private fields */ }
Expand description

Drives a DaemonPlugin as standardd would: activate, drive at the instants it asks for, events and calls.

Implementations§

Source§

impl<P: DaemonPlugin> DaemonHarness<P>

Source

pub fn activate(host: MockHost, config: &str) -> Self

Installs host and activates the plugin with config.

Source

pub fn drive(&mut self, now_ms: u64) -> Option<u64>

Delivers what happened on the machine since the last drive (a scripted child’s output and exit, file changes), then runs the plugin’s tasks at now_ms; when it next wants to run.

Source

pub fn output(&mut self, pid: u32, stderr: bool, bytes: &[u8])

Output of a running child, as its piped stream carries it; delivered on the next DaemonHarness::drive.

Source

pub fn exit(&mut self, pid: u32, status: i32)

A running child exits with status; delivered on the next drive.

Source

pub fn file_changed(&mut self, path: &str) -> usize

Something changed at path: every watch that covers it, at its depth and outside its exclude globs, hears it on the next drive. How many watches hear it.

Source

pub fn plugin<R>(&self, f: impl FnOnce(&P) -> R) -> R

The plugin, to assert on its state.

Source

pub fn event(&mut self, event: Event)

Delivers an event (drive afterwards to let the plugin see it).

Source

pub fn interest(&mut self, surfaces: &[&str])

The account’s viewers now show exactly surfaces of the plugin, as the host reports it (the INTEREST_EVENT plugin event); the plugin hears Event::Interest on the next drive when it changed. &[]: nobody looks.

Source

pub fn call(&mut self, method: &str, request: &str) -> Result<String>

Calls the plugin’s call handler as its UI half would.

Source

pub fn call_from( &mut self, method: &str, request: &str, caller: Caller, ) -> Result<String>

Calls the plugin’s call handler as caller.

Source

pub fn host<R>(&self, f: impl FnOnce(&mut MockHost) -> R) -> R

Source

pub fn deactivate(self)

Auto Trait Implementations§

§

impl<P> !Freeze for DaemonHarness<P>

§

impl<P> !RefUnwindSafe for DaemonHarness<P>

§

impl<P> !Send for DaemonHarness<P>

§

impl<P> !UnwindSafe for DaemonHarness<P>

§

impl<P> Sync for DaemonHarness<P>
where DaemonRuntime<P>: Sync,

§

impl<P> Unpin for DaemonHarness<P>
where DaemonRuntime<P>: Unpin,

§

impl<P> UnsafeUnpin for DaemonHarness<P>
where DaemonRuntime<P>: UnsafeUnpin,

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> 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> Resource for T
where T: 'static,

Source§

type Rep = Option<T>

The type which is actually stored in-memory for this resource. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.