Function chd_precache_progress

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn chd_precache_progress(
    chd: *mut chd_file,
    progress: Option<unsafe extern "C" fn(pos: usize, total: usize, param: *mut c_void)>,
    param: *mut c_void,
) -> chd_error
Available on chd_precache only.
Expand description

Precache the underlying file into memory with an optional callback to report progress.

The underlying stream of the input chd_file is swapped with a layout-undefined in-memory stream.

If the provenance of the original chd_file is from chd_open, then the underlying stream is safely dropped.

If instead the underlying stream is a core_file opened from chd_open_file, or chd_open_core_file, then the same semantics of calling chd_core_file applies, and ownership of the underlying stream is released to the caller.

After precaching, the input chd_file no longer returns a valid inner stream when passed to chd_core_file, and should be treated as having the same provenance as being from chd_open.

ยงSafety