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>
impl<P: DaemonPlugin> DaemonHarness<P>
Sourcepub fn activate(host: MockHost, config: &str) -> Self
pub fn activate(host: MockHost, config: &str) -> Self
Installs host and activates the plugin with config.
Sourcepub fn drive(&mut self, now_ms: u64) -> Option<u64>
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.
Sourcepub fn output(&mut self, pid: u32, stderr: bool, bytes: &[u8])
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.
Sourcepub fn exit(&mut self, pid: u32, status: i32)
pub fn exit(&mut self, pid: u32, status: i32)
A running child exits with status; delivered on the next drive.
Sourcepub fn file_changed(&mut self, path: &str) -> usize
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.
Sourcepub fn event(&mut self, event: Event)
pub fn event(&mut self, event: Event)
Delivers an event (drive afterwards to let the plugin see it).
Sourcepub fn interest(&mut self, surfaces: &[&str])
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.
Sourcepub fn call(&mut self, method: &str, request: &str) -> Result<String>
pub fn call(&mut self, method: &str, request: &str) -> Result<String>
Calls the plugin’s call handler as its UI half would.
Sourcepub fn call_from(
&mut self,
method: &str,
request: &str,
caller: Caller,
) -> Result<String>
pub fn call_from( &mut self, method: &str, request: &str, caller: Caller, ) -> Result<String>
Calls the plugin’s call handler as caller.