Skip to main content

Harness

Struct Harness 

Source
pub struct Harness<P: UiPlugin> { /* private fields */ }
Expand description

Drives a UiPlugin as a viewer does, on this thread’s MockHost.

Implementations§

Source§

impl<P: UiPlugin> Harness<P>

Source

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

Installs host and activates the plugin with config.

Source

pub fn resize(&mut self, surface: &str, geometry: Geometry)

Lays a surface out at geometry and delivers the resize event.

Source

pub fn frame( &mut self, now_ms: u64, interval_ms: u32, power: Power, ) -> Option<u64>

Calls frame with the paced interval and power state a viewer passes; returns when the plugin wants the next one.

Source

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

Source

pub fn show(&mut self, surface: &str, visible: bool)

Shows or hides a surface, as the viewer does when it places it.

Source

pub fn set_capabilities(&mut self, capabilities: Capabilities)

Changes what the viewer can show and tells the plugin.

Source

pub fn set_theme(&mut self, theme: Theme)

Changes the theme and tells the plugin.

Source

pub fn set_model(&mut self, surface: &str, model: Model)

Switches a multi-model surface to model, as the viewer does when its graphics support changes.

Source

pub fn key(&mut self, surface: &str, code: KeyCode)

A key press on surface.

Source

pub fn paste(&mut self, surface: &str, text: &str)

Text pasted into surface.

Source

pub fn pointer(&mut self, surface: &str, kind: PointerKind, x: u32, y: u32)

A pointer event at (x, y) in the surface’s units.

Source

pub fn command(&mut self, id: &str)

Runs one of the manifest’s commands.

Source

pub fn answer_calls(&mut self) -> usize

Answers every call-async the plugin made so far from MockHost::call_answers, delivering one Event::CallResult each, in order. Returns how many.

Source

pub fn take_frame_request(&mut self) -> Option<u64>

The frame the plugin asked for from an event, and clears it.

Source

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

The plugin, to assert on its state.

Source

pub fn commits(&self, surface: &str) -> Vec<MockCommit>

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 Harness<P>

§

impl<P> !RefUnwindSafe for Harness<P>

§

impl<P> Send for Harness<P>
where UiRuntime<P>: Send,

§

impl<P> Sync for Harness<P>
where UiRuntime<P>: Sync,

§

impl<P> Unpin for Harness<P>
where UiRuntime<P>: Unpin,

§

impl<P> UnsafeUnpin for Harness<P>
where UiRuntime<P>: UnsafeUnpin,

§

impl<P> UnwindSafe for Harness<P>
where UiRuntime<P>: UnwindSafe,

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.