Skip to main content

Crate zarrs_conventions_thumbnails

Crate zarrs_conventions_thumbnails 

Source
Expand description

§zarrs_conventions_thumbnails

Rust implementation of the Thumbnails Zarr convention.

This convention allows a Zarr node to refer to thumbnails which represent that node in some way.

§Usage

use zarrs_conventions_thumbnails::{Thumbnails, Thumbnail, ThumbnailLocation};

// Create a thumbnail with a path
let mut thumb = Thumbnail::try_new(
    96,
    96,
    "image/jpeg",
    ThumbnailLocation::new_path("thumbnails/thumb96.jpeg"),
).unwrap();

// Set optional description
*thumb.description_mut() = Some("A 96x96 JPEG thumbnail".to_string());

// Add arbitrary attributes
thumb.attributes_mut().insert("z_slice".to_string(), serde_json::json!(123));

// Create thumbnails collection (Thumbnails derefs to Vec<Thumbnail>)
let thumbnails: Thumbnails = vec![thumb].into();

Re-exports§

pub use zarrs_conventions;

Structs§

Thumbnail
A single thumbnail representing a Zarr node.
Thumbnails
A collection of thumbnails representing a Zarr node.

Enums§

ThumbnailLocation
Location of a thumbnail: either a relative path or a URL.