Skip to main content

DatasetBuilder

Struct DatasetBuilder 

Source
pub struct DatasetBuilder<T: H5Type> { /* private fields */ }
Expand description

A fluent builder for creating datasets.

Obtained from H5File::new_dataset::<T>().

let file = H5File::create("builder.h5").unwrap();
let ds = file.new_dataset::<f32>()
    .shape(&[10, 20])
    .create("temperatures")
    .unwrap();

Implementations§

Source§

impl<T: H5Type> DatasetBuilder<T>

Source

pub fn shape<S: AsRef<[usize]>>(self, dims: S) -> Self

Set the dataset dimensions.

This is required before calling create. Use an empty slice &[] for a scalar (0-dimensional) dataset.

Source

pub fn scalar(self) -> Self

Create a scalar (0-dimensional) dataset holding a single value.

Source

pub fn chunk(self, chunk_dims: &[usize]) -> Self

Set chunk dimensions for chunked storage.

When set, the dataset uses chunked storage with the extensible array index. You should also call max_shape or resizable to allow extending.

Source

pub fn resizable(self) -> Self

Make all dimensions unlimited (resizable).

This sets max_dims to u64::MAX for all dimensions.

Source

pub fn max_shape(self, max: &[Option<usize>]) -> Self

Set maximum dimensions. None means unlimited for that dimension.

Source

pub fn deflate(self, level: u32) -> Self

Enable deflate (gzip) compression with the given level (0-9).

Requires chunked storage (call .chunk() before .create()). Level 0 = no compression, 9 = maximum compression. Default is 6.

Source

pub fn shuffle_deflate(self, level: u32) -> Self

Enable shuffle + deflate compression.

Shuffle reorders bytes by position within elements before compression, which typically improves compression ratios for numeric data. Requires chunked storage.

Source

pub fn zstd(self, level: u32) -> Self

Enable Zstandard compression with the given level (1-22, default 3).

Requires chunked storage (call .chunk() before .create()).

Source

pub fn filter_pipeline(self, pipeline: FilterPipeline) -> Self

Set a custom filter pipeline for compression.

This takes precedence over deflate and shuffle_deflate. Requires chunked storage.

Source

pub fn create(self, name: &str) -> Result<H5Dataset>

Finalize and create the dataset with the given name.

The name is the link name within the root group (e.g. "data" or "group1/data" once nested groups are supported).

Auto Trait Implementations§

§

impl<T> Freeze for DatasetBuilder<T>

§

impl<T> !RefUnwindSafe for DatasetBuilder<T>

§

impl<T> !Send for DatasetBuilder<T>

§

impl<T> !Sync for DatasetBuilder<T>

§

impl<T> Unpin for DatasetBuilder<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for DatasetBuilder<T>

§

impl<T> !UnwindSafe for DatasetBuilder<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.