Skip to main content

FileAccessProperties

Struct FileAccessProperties 

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

File-access properties applied when opening an HDF5 file.

This is the hdf5-pure analogue of an HDF5 file access property list (fapl): one value carrying every access-time setting, built once and passed to whichever open a caller reaches for, exactly as a fapl is handed to H5Fopen. Every *_with_options constructor on File accepts it, so a read path and a read-write path can share one configuration.

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. fapl and each H5Pset_* it models are doc aliases, so a search for either lands here.

  • The metadata cache (H5Pset_mdc_config) applies to the streaming and bounded backends; an in-memory open already holds the whole file in one buffer.
  • The chunk cache (H5Pset_cache) is the file-wide default for datasets opened from any backend, overridable per dataset with DatasetAccessProperties.
  • The locking policy (H5Pset_file_locking) applies to the read-write opens. Readers and the SWMR writer take no lock by design, so they ignore it.

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

Implementations§

Source§

impl FileAccessProperties

Source

pub const fn new() -> Self

A value carrying the crate’s default access behavior.

Source

pub const fn with_metadata_cache( self, metadata_cache: MetadataCacheConfig, ) -> Self

Configure the bounded streaming metadata cache.

Source

pub const fn with_chunk_cache(self, chunk_cache: ChunkCacheConfig) -> Self

Configure the per-dataset raw chunk cache used by datasets opened from this file. This is the H5Pset_cache-style file-wide default.

Source

pub const fn with_locking(self, locking: FileLocking) -> Self

Set the OS advisory file-locking policy for the read-write opens.

Defaults to FileLocking::Enabled. Use FileLocking::Disabled only when an external mechanism already guarantees single-writer access, or FileLocking::BestEffort on a filesystem (such as some network mounts) where the OS lock is unavailable. Setting HDF5_USE_FILE_LOCKING in the environment overrides this, as in the C library.

Readers and File::open_swmr_writer take no lock by design and ignore this.

Source

pub const fn with_memory_strategy(self, memory_strategy: MemoryStrategy) -> Self

Set how much memory a read-write open may use to hold the file.

Unset by default, which lets the entry point choose: File::open_rw uses MemoryStrategy::Auto, preferring the bounded engine and falling back to the whole-file mirror for a file it cannot edit, while the deprecated File::open_rw_bounded uses MemoryStrategy::Bounded, refusing such a file rather than quietly spending O(file size) memory on a caller who asked not to. Setting this overrides both, in either direction; MemoryStrategy::Mirrored takes the whole-file mirror unconditionally, as open_rw did before it learned to dispatch.

The read-only opens ignore this: they build no editing session at all, and their own names say what memory they spend. File::open_swmr_writer does build one, and always mirrors: it accepts MemoryStrategy::Auto and MemoryStrategy::Mirrored, both of which the mirror satisfies, and refuses an explicit MemoryStrategy::Bounded with Error::EditUnsupported rather than quietly not honoring it. Ask a File which backend it resolved to with File::edit_backing.

Source

pub const fn metadata_cache(&self) -> MetadataCacheConfig

Return the configured streaming metadata cache.

Source

pub const fn chunk_cache(&self) -> ChunkCacheConfig

Return the configured per-dataset chunk cache.

Source

pub const fn locking(&self) -> FileLocking

Return the configured file-locking policy.

Source

pub const fn memory_strategy(&self) -> Option<MemoryStrategy>

Return the configured memory strategy, or None when none was asked for and the entry point’s own default applies. This is what was requested; for which backend an open resolved to, see File::edit_backing.

The Option exists so the deprecated File::open_rw_bounded can default to MemoryStrategy::Bounded while File::open_rw defaults to MemoryStrategy::Auto; when that pair is removed this should collapse to a plain MemoryStrategy with Auto as the default, in that same release rather than as a second break on this accessor.

Trait Implementations§

Source§

impl Clone for FileAccessProperties

Source§

fn clone(&self) -> FileAccessProperties

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 FileAccessProperties

Source§

impl Debug for FileAccessProperties

Source§

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

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

impl Default for FileAccessProperties

Source§

fn default() -> FileAccessProperties

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

impl Eq for FileAccessProperties

Source§

impl PartialEq for FileAccessProperties

Source§

fn eq(&self, other: &FileAccessProperties) -> 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 FileAccessProperties

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.