Trait c2pa::IngredientOptions

source ·
pub trait IngredientOptions {
    // Provided methods
    fn title(&self, _path: &Path) -> Option<String> { ... }
    fn hash(&self, _path: &Path) -> Option<String> { ... }
    fn thumbnail(&self, _path: &Path) -> Option<(String, Vec<u8>)> { ... }
    fn base_path(&self) -> Option<&Path> { ... }
}
Available on crate feature file_io only.
Expand description

This defines optional operations when creating Ingredient structs from files.

Provided Methods§

source

fn title(&self, _path: &Path) -> Option<String>

This allows setting the title for the ingredient.

If it returns None, then the default behavior is to use the file’s name.

source

fn hash(&self, _path: &Path) -> Option<String>

Returns an optional hash value for the ingredient

This can be used to test for duplicate ingredients or if a source file has changed. If hash is_some() Manifest.add_ingredient will dedup matching hashes

source

fn thumbnail(&self, _path: &Path) -> Option<(String, Vec<u8>)>

Returns an optional thumbnail image representing the asset

The first value is the content type of the thumbnail, i.e. image/jpeg The second value is bytes of the thumbnail image The default is to have no thumbnail, so you must provide an override to have a thumbnail image

source

fn base_path(&self) -> Option<&Path>

Returns an optional folder path

If Some, binary data will be stored in files in the given folder

Implementors§