Skip to main content

DebugBridge

Struct DebugBridge 

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

The collectors, by name.

Implementations§

Source§

impl DebugBridge

Source

pub fn new() -> Self

Source

pub fn with_core_collectors() -> Self

A bridge with the collectors of this crate: screen, focus, overlays, fields, faults, announcements, state and theme.

Source

pub fn register(&mut self, c: impl Collector + 'static) -> Result<(), String>

Adds a collector; a second one with the same name is refused.

Source

pub fn unregister(&mut self, name: &str) -> bool

Removes a collector; whether there was one.

Source

pub fn names(&self) -> Vec<String>

Source

pub fn offer_to_agents(&mut self, action: &str)

Offers an action to agents (collector.action, dialogs.answer) whatever it declares: the application’s choice, for an agent it trusts with it (a test harness, a kiosk’s own automation).

Source

pub fn offered(&self) -> impl Iterator<Item = &str>

The actions the application offered to agents.

Source

pub fn action(&self, collector: &str, action: &str) -> Option<ActionSpec>

An action, as agents see it (agent says whether they may call it); None when there is no such collector or action.

Source

pub fn set_mode(&mut self, mode: BridgeMode)

What the bridge lets anyone but the user do.

Source

pub fn mode(&self) -> BridgeMode

Source

pub fn mutates( &self, collector: &str, action: &str, args: &Json, ) -> Option<bool>

Whether this call changes the application (None: no such action).

Source

pub fn destructive(&self, collector: &str, action: &str, args: &Json) -> bool

Whether this call destroys or discards what cannot easily be had back (Collector::destructive); false when there is no such collector.

Source

pub fn refusal( &self, collector: &str, action: &str, args: &Json, origin: &Origin, ) -> Option<String>

Why origin may not make this call: None when it may (or when there is no such action: the call says so). Anyone but the user is held to the bridge’s mode (BridgeMode) and to the action’s agent flag; the user never is.

Source

pub fn record(&mut self, feedback: Feedback)

Keeps a feedback block in the log (a call refused or vetoed before it reached the bridge).

Source

pub fn describe(&self) -> Json

Every collector, its description and actions.

Source

pub fn capabilities(&self) -> Vec<Json>

Every collector action as a capability of PROTOCOL 1, one entry each: kind (action), name (collector.action), description, mutates, agent, destructive (without arguments), args (a JSON Schema, or null), example (example arguments), result (a JSON Schema, or null) and call (collector, action). An application adds its commands beside them (AppHandle::debug_capabilities).

Source

pub fn snapshot(&self, ctx: &Context) -> Json

Every collector’s snapshot, by name.

Source

pub fn snapshot_of(&self, ctx: &Context, name: &str) -> Option<Json>

One collector’s snapshot.

Source

pub fn call( &mut self, ctx: &Context, collector: &str, action: &str, args: &Json, ) -> Feedback

Calls an action as the agent (Origin::Agent("debug-bridge")): an action not offered to agents is refused. Unknown collectors and actions get a feedback listing what exists.

Source

pub fn call_as( &mut self, ctx: &Context, collector: &str, action: &str, args: &Json, origin: &Origin, ) -> Feedback

Calls an action for origin: only the user may call an action not offered to agents (DebugBridge::refusal).

Source

pub fn log(&self) -> impl Iterator<Item = &Feedback>

The last feedback blocks, oldest first.

Trait Implementations§

Source§

impl Debug for DebugBridge

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DebugBridge

Source§

fn default() -> DebugBridge

Returns the “default value” for a type. 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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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

§

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

§

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

§

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

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,