Skip to main content

MediaLoader

Trait MediaLoader 

Source
pub trait MediaLoader {
    // Required methods
    fn load(&self, path: &Path) -> Result<CoverMedia, MediaError>;
    fn save(&self, media: &CoverMedia, path: &Path) -> Result<(), MediaError>;
}
Expand description

Codec adapter port for loading and saving cover media files.

I/O is performed by the adapter; the domain receives decoded pixels/samples.

Required Methods§

Source

fn load(&self, path: &Path) -> Result<CoverMedia, MediaError>

Load a media file from path and return decoded CoverMedia.

§Errors

Returns MediaError::UnsupportedFormat, MediaError::DecodeFailed, or MediaError::IoError.

Source

fn save(&self, media: &CoverMedia, path: &Path) -> Result<(), MediaError>

Encode media and write it to path.

§Errors

Returns MediaError::EncodeFailed or MediaError::IoError.

Implementors§