pub struct FpZipCompressor { /* private fields */ }Expand description
Builder for configuring and executing fpzip compression.
Provides a fluent API for setting dimensions and precision before compressing.
Defaults to 1D (ny=1, nz=1, nf=1) at full precision (lossless).
§Example
use fpzip_rs::{FpZipCompressor, decompress_f32};
let data: Vec<f32> = (0..64).map(|i| i as f32).collect();
let compressed = FpZipCompressor::new(4)
.ny(4)
.nz(4)
.compress_f32(&data)
.unwrap();
let decompressed = decompress_f32(&compressed).unwrap();
assert_eq!(data, decompressed);Implementations§
Source§impl FpZipCompressor
impl FpZipCompressor
Sourcepub fn prec(self, prec: u32) -> Self
pub fn prec(self, prec: u32) -> Self
Sets the bit precision for lossy compression.
0or full type width (32 for float, 64 for double) = lossless.- For float: valid range is 2..=32.
- For double: valid range is 4..=64 (even values only).
- Lower precision gives better compression ratios at the cost of accuracy.
Sourcepub fn compress_f32(&self, data: &[f32]) -> Result<Vec<u8>>
pub fn compress_f32(&self, data: &[f32]) -> Result<Vec<u8>>
Compresses a float slice with the configured dimensions and precision.
Sourcepub fn compress_f64(&self, data: &[f64]) -> Result<Vec<u8>>
pub fn compress_f64(&self, data: &[f64]) -> Result<Vec<u8>>
Compresses a double slice with the configured dimensions and precision.
Auto Trait Implementations§
impl Freeze for FpZipCompressor
impl RefUnwindSafe for FpZipCompressor
impl Send for FpZipCompressor
impl Sync for FpZipCompressor
impl Unpin for FpZipCompressor
impl UnsafeUnpin for FpZipCompressor
impl UnwindSafe for FpZipCompressor
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
Mutably borrows from an owned value. Read more