Crate treasury_import
source · [−]Expand description
Contains everything that is required to create treasury importers library.
Usage
struct FooImporter;
impl treasury_import::Importer for FooImporter {
fn import(
&self,
source: &std::path::Path,
output: &std::path::Path,
_sources: &impl treasury_import::Sources,
_dependencies: &impl treasury_import::Dependencies,
) -> Result<(), treasury_import::ImportError> {
match std::fs::copy(source, output) {
Ok(_) => Ok(()),
Err(err) => Err(treasury_import::ImportError::Other { reason: "SOMETHING WENT WRONG".to_owned() }),
}
}
}
// Define all required exports.
treasury_import::make_treasury_importers_library! {
// [extensions list] <name> : <source-format> -> <target-format> = <expr>;
// <expr> must have type &'static I where I: Importer
// Use `Box::leak(importer)` if importer instance cannot be constructed in constant expression.
[foo] foo : foo -> foo = &FooImporter;
}Macros
Define exports required for an importers library.
Accepts repetition of the following pattern:
&'static impl Importer]“>
Structs
Enums
Result of Importer::import method.