pub struct DebugBridge { /* private fields */ }Expand description
The collectors, by name.
Implementations§
Source§impl DebugBridge
impl DebugBridge
pub fn new() -> Self
Sourcepub fn with_core_collectors() -> Self
pub fn with_core_collectors() -> Self
A bridge with the collectors of this crate: screen, focus, overlays, fields, faults, announcements, state and theme.
Sourcepub fn register(&mut self, c: impl Collector + 'static) -> Result<(), String>
pub fn register(&mut self, c: impl Collector + 'static) -> Result<(), String>
Adds a collector; a second one with the same name is refused.
Sourcepub fn unregister(&mut self, name: &str) -> bool
pub fn unregister(&mut self, name: &str) -> bool
Removes a collector; whether there was one.
pub fn names(&self) -> Vec<String>
Sourcepub fn offer_to_agents(&mut self, action: &str)
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).
Sourcepub fn offered(&self) -> impl Iterator<Item = &str>
pub fn offered(&self) -> impl Iterator<Item = &str>
The actions the application offered to agents.
Sourcepub fn action(&self, collector: &str, action: &str) -> Option<ActionSpec>
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.
Sourcepub fn set_mode(&mut self, mode: BridgeMode)
pub fn set_mode(&mut self, mode: BridgeMode)
What the bridge lets anyone but the user do.
pub fn mode(&self) -> BridgeMode
Sourcepub fn mutates(
&self,
collector: &str,
action: &str,
args: &Json,
) -> Option<bool>
pub fn mutates( &self, collector: &str, action: &str, args: &Json, ) -> Option<bool>
Whether this call changes the application (None: no such
action).
Sourcepub fn destructive(&self, collector: &str, action: &str, args: &Json) -> bool
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.
Sourcepub fn refusal(
&self,
collector: &str,
action: &str,
args: &Json,
origin: &Origin,
) -> Option<String>
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.
Sourcepub fn record(&mut self, feedback: Feedback)
pub fn record(&mut self, feedback: Feedback)
Keeps a feedback block in the log (a call refused or vetoed before it reached the bridge).
Sourcepub fn capabilities(&self) -> Vec<Json>
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).
Sourcepub fn snapshot_of(&self, ctx: &Context, name: &str) -> Option<Json>
pub fn snapshot_of(&self, ctx: &Context, name: &str) -> Option<Json>
One collector’s snapshot.
Sourcepub fn call(
&mut self,
ctx: &Context,
collector: &str,
action: &str,
args: &Json,
) -> Feedback
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.
Trait Implementations§
Source§impl Debug for DebugBridge
impl Debug for DebugBridge
Source§impl Default for DebugBridge
impl Default for DebugBridge
Source§fn default() -> DebugBridge
fn default() -> DebugBridge
Auto Trait Implementations§
impl Freeze for DebugBridge
impl !RefUnwindSafe for DebugBridge
impl !Send for DebugBridge
impl !Sync for DebugBridge
impl Unpin for DebugBridge
impl UnsafeUnpin for DebugBridge
impl !UnwindSafe for DebugBridge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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