Skip to main content

Collector

Trait Collector 

Source
pub trait Collector {
    // Required methods
    fn name(&self) -> &str;
    fn description(&self) -> &str;
    fn snapshot(&self, ctx: &Context) -> Json;

    // Provided methods
    fn actions(&self) -> Vec<ActionSpec> { ... }
    fn mutates(&self, action: &str, _args: &Json) -> Option<bool> { ... }
    fn destructive(&self, _action: &str, _args: &Json) -> bool { ... }
    fn call(
        &mut self,
        _ctx: &Context,
        action: &str,
        _args: &Json,
        _origin: &Origin,
    ) -> Result<Json, String> { ... }
    fn schemas(&self, _action: &str) -> Schemas { ... }
}
Expand description

A part of the application, seen by the bridge.

Required Methods§

Source

fn name(&self) -> &str

Source

fn description(&self) -> &str

Source

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

Provided Methods§

Source

fn actions(&self) -> Vec<ActionSpec>

Source

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

Whether this call of an action changes the application: its mutates, unless the action says per call (commands.run of a read-only command does not). None: no such action.

Source

fn destructive(&self, _action: &str, _args: &Json) -> bool

Whether this call of an action destroys or discards what cannot easily be had back (commands.run of a destructive command): an agent’s call then waits for the user to confirm it (the agent socket asks). false by default, and for an unknown action.

Source

fn call( &mut self, _ctx: &Context, action: &str, _args: &Json, _origin: &Origin, ) -> Result<Json, String>

Runs an action for origin, who called it: an action that acts does so as its caller (writes a value, runs a command, answers a dialog).

Source

fn schemas(&self, _action: &str) -> Schemas

The JSON Schemas of an action’s arguments and result, when its author gives them (none by default).

Implementors§