INNER CODE UNIT · Rust

from_bytes_err

RyanCodrai/turbovec · turbovec-python/src/lib.rs:264

fn from_bytes_err(e: std::io::Error) -> PyErr {
    pyo3::exceptions::PyValueError::new_err(e.to_string())
}

/// Shared body of both indexes' `__reduce__`: rebuild through the
/// object's own `from_bytes` classmethod applied to its `to_bytes()`
/// payload.
///
/// `pickle`, `copy.copy` and `copy.deepcopy` therefore all inherit the
/// documented `.tv` persistence contract unchanged — the same payload
/// `write` produces and the same load-time validation. Nothing here
/// widens or narrows what `to_bytes` carries; a reconstructed index is
/// exactly what `from_bytes(to_bytes())` has always produced, and is
/// fully independent of the original (#340).
///
/// Reducing to the public classmethod rather than a private rebuild
/// helper keeps `to_bytes`/`from_bytes` the single serialization path
/// (docs/api.md) and keeps the pickle stream readable.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…