OutputPlugin

Trait OutputPlugin 

Source
pub trait OutputPlugin: Send + Sync {
    // Required method
    fn process(
        &self,
        output: &mut Value,
        result: &Result<(SearchAppResult, SearchInstance), CompassAppError>,
    ) -> Result<(), OutputPluginError>;
}
Expand description

Performs some kind of post-processing on a search result. The result JSON is available to the plugin as a reference which was potentially modified upstream by another output plugin. The plugin will output a modified version of the JSON as a result.

A simple No-operation OutputPlugin would simply clone its JSON argument.

§Default OutputPlugins

The following default set of output plugin builders are found in the super::default module:

  • summary - simple plugin appends cost and distance to result
  • traversal - fully-featured plugin for traversal outputs in different formats
  • uuid - attach the original graph ids to a result

Required Methods§

Source

fn process( &self, output: &mut Value, result: &Result<(SearchAppResult, SearchInstance), CompassAppError>, ) -> Result<(), OutputPluginError>

Applies this OutputPlugin to a search result, passing along a JSON that will replace the output JSON argument.

§Arguments
  • output - the search result passed to this plugin
  • result - the result of the search via the internal representation. this is passed as a Result as the search may have failed.
§Returns

The modified JSON or an error

Implementors§