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
impl FileCreateProperties
Sourcepub const fn new() -> Self
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.
Sourcepub const fn with_userblock(self, size: u64) -> Self
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.
Sourcepub const fn with_libver_bounds(self, low: LibVer, high: LibVer) -> Self
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.
Sourcepub const fn with_file_space_strategy(
self,
strategy: FileSpaceStrategy,
persist: bool,
threshold: u64,
) -> Self
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.
Sourcepub const fn with_file_space_page_size(self, page_size: u64) -> Self
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.
Sourcepub const fn userblock(&self) -> u64
pub const fn userblock(&self) -> u64
Return the configured userblock size in bytes (0 for none).
Sourcepub const fn libver_bounds(&self) -> Option<(LibVer, LibVer)>
pub const fn libver_bounds(&self) -> Option<(LibVer, LibVer)>
Return the configured library-version bounds, if any.
Sourcepub const fn file_space_strategy(
&self,
) -> Option<(FileSpaceStrategy, bool, u64)>
pub const fn file_space_strategy( &self, ) -> Option<(FileSpaceStrategy, bool, u64)>
Return the configured file-space strategy, persist flag, and threshold, if any.
Sourcepub const fn file_space_page_size(&self) -> Option<u64>
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
impl Clone for FileCreateProperties
Source§fn clone(&self) -> FileCreateProperties
fn clone(&self) -> FileCreateProperties
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for FileCreateProperties
Source§impl Debug for FileCreateProperties
impl Debug for FileCreateProperties
Source§impl Default for FileCreateProperties
impl Default for FileCreateProperties
impl Eq for FileCreateProperties
Source§impl PartialEq for FileCreateProperties
impl PartialEq for FileCreateProperties
impl StructuralPartialEq for FileCreateProperties
Auto Trait Implementations§
impl Freeze for FileCreateProperties
impl RefUnwindSafe for FileCreateProperties
impl Send for FileCreateProperties
impl Sync for FileCreateProperties
impl Unpin for FileCreateProperties
impl UnsafeUnpin for FileCreateProperties
impl UnwindSafe for FileCreateProperties
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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