feat: adding rkyv export support and convert back to native type #138
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: add rkyv export support and convert back to native type
Summary
Add
rkyv-gated helpers to convert archived half-precision types back to their native counterparts, and re-export the archived types from the crate root.Changes
src/bfloat.rs#[cfg(feature = "rkyv")], implementimpl Archivedbf16:pub fn to_native(&self) -> bf16to convert the archived value back tobf16.src/binary16.rs#[cfg(feature = "rkyv")], implementimpl Archivedf16:pub fn to_native(&self) -> f16to convert the archived value back tof16.src/lib.rs#[cfg(feature = "rkyv")]:bfloat::Archivedbf16.binary16::Archivedf16.Motivation
These helpers make it easier to round-trip
bf16/f16when usingrkyv, and the root re-exports improve ergonomics by exposing the archived types alongside their native counterparts.