Skip to main content

Dataset

Struct Dataset 

Source
pub struct Dataset { /* private fields */ }
Expand description

A dataset within an HDF5 file.

Implementations§

Source§

impl Dataset

Source

pub fn name(&self) -> &str

Dataset name.

Source

pub fn address(&self) -> u64

The object header address used to parse this dataset. Useful as an opaque identifier or for NC4 data_offset.

Source

pub fn shape(&self) -> &[u64]

Shape of the dataset (dimensions).

Source

pub fn dtype(&self) -> &Datatype

Datatype of the dataset.

Source

pub fn ndim(&self) -> usize

Number of dimensions.

Source

pub fn max_dims(&self) -> Option<&[u64]>

Maximum dimension sizes, if defined. u64::MAX indicates unlimited.

Source

pub fn chunks(&self) -> Option<Vec<u32>>

Chunk dimensions, if the dataset is chunked.

Source

pub fn iter_chunks(&self) -> Result<DatasetChunkIterator>

Iterate over decoded chunks for a chunked dataset.

Source

pub fn chunk_cache_stats(&self) -> ChunkCacheStats

Return current chunk-cache statistics for this dataset’s file.

Source

pub fn fill_value(&self) -> Option<&FillValueMessage>

Fill value, if defined.

Source

pub fn attributes(&self) -> Vec<Attribute>

Dataset attributes.

Source

pub fn attribute(&self, name: &str) -> Result<Attribute>

Find an attribute by name.

Source

pub fn read_string(&self) -> Result<String>

Read a scalar string dataset or single string element.

Use Dataset::read_strings when the dataset contains multiple strings.

Source

pub fn read_strings(&self) -> Result<Vec<String>>

Read all string elements from a string-typed dataset.

Source

pub fn num_elements(&self) -> u64

Total number of elements in the dataset.

Source

pub fn read_array<T: H5Type>(&self) -> Result<ArrayD<T>>

Read the entire dataset into an n-dimensional array.

Source

pub fn read_into<T: H5Type>(&self, dst: &mut [T]) -> Result<()>

Read the entire dataset into a caller-provided typed buffer.

Source

pub fn read_array_parallel<T: H5Type>(&self) -> Result<ArrayD<T>>

Read the entire dataset using internal chunk-level parallelism when possible.

Non-chunked datasets fall back to read_array.

Source

pub fn read_array_in_pool<T: H5Type>( &self, pool: &ThreadPool, ) -> Result<ArrayD<T>>

Read the entire dataset using the provided Rayon thread pool.

Non-chunked datasets fall back to read_array.

Source

pub fn read_slice_parallel<T: H5Type>( &self, selection: &SliceInfo, ) -> Result<ArrayD<T>>

Read a hyperslab of the dataset using chunk-level parallelism when possible.

Chunked datasets decompress overlapping chunks in parallel via Rayon. Non-chunked layouts fall back to read_slice.

Source

pub fn read_slice<T: H5Type>(&self, selection: &SliceInfo) -> Result<ArrayD<T>>

Read a hyperslab of the dataset.

Source

pub fn read_raw_bytes(&self) -> Result<Vec<u8>>

Read the dataset as logical element bytes.

The returned bytes are after layout handling, chunk decompression, filter decoding, external raw-data resolution, and fill-value materialization. Numeric values remain in the dataset datatype’s byte order.

Source

pub fn raw_byte_len(&self) -> Result<usize>

Number of logical raw bytes in the entire dataset.

Source

pub fn read_raw_bytes_into(&self, dst: &mut [u8]) -> Result<()>

Read logical raw bytes into a caller-provided buffer.

The destination length must match Dataset::raw_byte_len. Numeric values remain in the dataset datatype’s byte order.

Source

pub fn read_native_bytes(&self) -> Result<Vec<u8>>

Read logical raw bytes converted to native-endian numeric fields.

Source

pub fn read_native_bytes_into(&self, dst: &mut [u8]) -> Result<()>

Read logical raw bytes into a buffer and convert numeric fields to native endian.

Source

pub fn vlen_reference_size(&self) -> usize

Size in bytes of one HDF5 variable-length reference in this file.

Source

pub fn raw_element_size(&self) -> usize

Size in bytes of one logical raw element in this file.

Variable-length strings and sequences are stored as global-heap references whose width depends on the file offset size.

Source

pub fn resolve_vlen_reference_bytes( &self, reference: &[u8], base_element_size: usize, ) -> Result<Vec<u8>>

Resolve one HDF5 variable-length reference into logical element bytes.

base_element_size is the byte width of one value in the vlen sequence. The sequence length stored in the reference is interpreted as an element count and multiplied by this size.

Trait Implementations§

Source§

impl Clone for Dataset

Source§

fn clone(&self) -> Dataset

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.