Integration with third-party tools

Fugue interfaces with external tools to populate its database representation (i.e., fugue-db). Currently, Fugue has plugins for the following:

Supporting new tools

To add support for a new tool, two steps are required:

  1. Implement suitable interfacing glue for the tool. In the most basic case, this will require serialising the tool's program representation to a file using the flatbuffers schema definition found in fugue-db/schema.
  2. Implement the fugue::db::backend::Backend trait to abstract the interface to the tool.

The template below provides a starting point:


#![allow(unused)]
fn main() {
use fugue::db::backend::{Backend, Imported};
use fugue::db::Error as ExportError;
use url::Url;

use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("MyNewTool is not available as a backend")]
    NotAvailable,
    // ...
}

impl From<Error> for ExportError {
    fn from(e: Error) -> Self {
        ExportError::importer_error("fugue-my-new-tool", e)
    }
}

pub struct MyNewTool;

impl Backend for MyNewTool {
    type Error = Error;

    fn name(&self) -> &'static str {
        "fugue-my-new-tool"
    }

    fn is_available(&self) -> bool {
        // ...
    }

    fn is_preferred_for(&self, path: &Url) -> Option<bool> {
        // ....
    }

    fn import(&self, program: &Url) -> Result<Imported, Self::Error> {
      // ...
    }
}
}

The return value of Backend::import can either point to a path to read the serialised flatbuffers representation from (Imported::File), or a vector of bytes (i.e., Vec<u8>) containing the representation (Imported::Bytes).