pub trait Backend {
type Error: Into<Error>;
// Required methods
fn name(&self) -> &'static str;
fn is_available(&self) -> bool;
fn is_preferred_for(&self, path: &Url) -> Option<bool>;
fn import(&self, program: &Url) -> Result<Imported, Self::Error>;
}Expand description
The Backend trait for adding support for new backend
§Example
use fugue_db::backend::{Backend, DatabaseImporterBackend, Imported};
use fugue_db::Error;
use url::Url;
pub struct MyNewTool{}
impl Backend for MyNewTool {
type Error = Error;
fn name(&self) -> &'static str {
"fugue-my-new-tool"
}
fn is_available(&self) -> bool {
todo!()
}
// ...
fn import(&self, program: &Url) -> Result<Imported, Self::Error> {
todo!()
}
fn is_preferred_for(&self, _: &Url) -> Option<bool> { todo!() }
}