Skip to main content

FileCreateProperties

Struct FileCreateProperties 

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

File-creation properties applied when writing a new HDF5 file.

This is the hdf5-pure analogue of an HDF5 file creation property list (fcpl): one value carrying every creation-time setting, so application code can define a file layout once and reuse it everywhere it writes, instead of repeating a builder call chain and keeping the copies in sync.

The Properties suffix means the type stands in for one whole HDF5 property list, so every setting on it has a C counterpart to look up. It is a stand-in and not a port: a plain Copy value, with no handle to create or close, no runtime property registry, and no setter that can fail. fcpl and each H5Pset_* it models are doc aliases, so a search for either lands here.

One setting crosses the class line. H5Pset_libver_bounds is officially a file access property, but this crate checks the bound as the file is written, so with_libver_bounds lives here with the other write-time settings rather than on FileAccessProperties.

Pass it to FileBuilder::with_create_properties or File::create_with_options. The equivalent FileBuilder methods set the same fields one at a time and interoperate freely with this.

Values are recorded as given and checked when the file is written, not when the properties are built — the value is inert data, so an illegal page size is reported by finish/write rather than here. Note that a non-paged userblock size is currently not validated against HDF5’s power-of-two rule; see the property-support reference for the exact coverage.

See the property-support reference for the full property-by-property map.

§Examples

use hdf5_pure::{FileCreateProperties, FileSpaceStrategy};

// Define the layout once...
fn paged_layout() -> FileCreateProperties {
    FileCreateProperties::new()
        .with_file_space_strategy(FileSpaceStrategy::Page, true, 1)
        .with_file_space_page_size(8192)
}

// ...and reuse it across every write path.
let mut builder = hdf5_pure::FileBuilder::new();
builder.with_create_properties(paged_layout());
builder.create_dataset("data").with_f64_data(&[1.0, 2.0]);
builder.write("out.h5").unwrap();

Implementations§

Source§

impl FileCreateProperties

Source

pub const fn new() -> Self

A value carrying the crate’s default creation behavior: no userblock, no library-version bounds, and the writer’s default file-space handling.

Source

pub const fn with_userblock(self, size: u64) -> Self

Reserve a zero-filled userblock of size bytes before the superblock.

HDF5 requires a power of two >= 512, or 0 for no userblock; the check runs when the file is written. See FileBuilder::with_userblock for how to fill the region afterward.

Source

pub const fn with_libver_bounds(self, low: LibVer, high: LibVer) -> Self

Constrain the on-disk format version to [low, high].

This crate writes exactly one format, so the bound is a compatibility assertion rather than a format selector — see FileBuilder::with_libver_bounds.

HDF5 classes H5Pset_libver_bounds as a file access property; it sits here because this crate checks the bound at write time.

Source

pub const fn with_file_space_strategy( self, strategy: FileSpaceStrategy, persist: bool, threshold: u64, ) -> Self

Set the file-space management strategy, whether free space persists across close, and the smallest free-space section tracked.

Source

pub const fn with_file_space_page_size(self, page_size: u64) -> Self

Set the file-space page size, the allocation quantum under FileSpaceStrategy::Page.

Source

pub const fn userblock(&self) -> u64

Return the configured userblock size in bytes (0 for none).

Source

pub const fn libver_bounds(&self) -> Option<(LibVer, LibVer)>

Return the configured library-version bounds, if any.

Source

pub const fn file_space_strategy( &self, ) -> Option<(FileSpaceStrategy, bool, u64)>

Return the configured file-space strategy, persist flag, and threshold, if any.

Source

pub const fn file_space_page_size(&self) -> Option<u64>

Return the configured file-space page size, if any.

Trait Implementations§

Source§

impl Clone for FileCreateProperties

Source§

fn clone(&self) -> FileCreateProperties

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
Source§

impl Copy for FileCreateProperties

Source§

impl Debug for FileCreateProperties

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileCreateProperties

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for FileCreateProperties

Source§

impl PartialEq for FileCreateProperties

Source§

fn eq(&self, other: &FileCreateProperties) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileCreateProperties

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> Same for T

Source§

type Output = T

Should always be Self
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.