Vendored version of rkyv from crates.io
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
David Koloski 4a841456f3
Some checks failed
CI / Format control / big_endian aligned pointer_width_16 (push) Failing after 0s
CI / Format control / big_endian aligned pointer_width_32 (push) Failing after 0s
CI / Format control / big_endian aligned pointer_width_64 (push) Failing after 0s
CI / Format control / little_endian aligned pointer_width_16 (push) Failing after 0s
CI / Format control / little_endian aligned pointer_width_32 (push) Failing after 0s
CI / Format control / little_endian aligned pointer_width_64 (push) Failing after 0s
CI / Format control / big_endian unaligned pointer_width_16 (push) Failing after 0s
CI / Format control / big_endian unaligned pointer_width_32 (push) Failing after 0s
CI / Format control / big_endian unaligned pointer_width_64 (push) Failing after 0s
CI / Format control / little_endian unaligned pointer_width_16 (push) Failing after 0s
CI / Format control / little_endian unaligned pointer_width_32 (push) Failing after 0s
CI / Format control / little_endian unaligned pointer_width_64 (push) Failing after 0s
CI / Features / (push) Failing after 0s
CI / Features / bytecheck (push) Failing after 0s
CI / Features / alloc (push) Failing after 0s
CI / Features / alloc bytecheck (push) Failing after 0s
CI / Features / std (push) Failing after 0s
CI / Features / std bytecheck (push) Failing after 0s
CI / Features / arrayvec-0_7 bytes-1 hashbrown-0_14 hashbrown-0_15 hashbrown-0_16 hashbrown-0_17 indexmap-2 smallvec-1 smol_str-0_2 smol_str-0_3 thin-vec-0_2 tinyvec-1 triomphe-0_1 uuid-1 (push) Failing after 0s
CI / Features / bytecheck arrayvec-0_7 bytes-1 hashbrown-0_14 hashbrown-0_15 hashbrown-0_16 hashbrown-0_17 indexmap-2 smallvec-1 smol_str-0_2 smol_str-0_3 thin-vec-0_2 tinyvec-1 triomphe-0_1 uuid-1 (push) Failing after 0s
CI / Features / alloc arrayvec-0_7 bytes-1 hashbrown-0_14 hashbrown-0_15 hashbrown-0_16 hashbrown-0_17 indexmap-2 smallvec-1 smol_str-0_2 smol_str-0_3 thin-vec-0_2 tinyvec-1 triomphe-0_1 uuid-1 (push) Failing after 0s
CI / Features / alloc bytecheck arrayvec-0_7 bytes-1 hashbrown-0_14 hashbrown-0_15 hashbrown-0_16 hashbrown-0_17 indexmap-2 smallvec-1 smol_str-0_2 smol_str-0_3 thin-vec-0_2 tinyvec-1 triomphe-0_1 uuid-1 (push) Failing after 0s
CI / Features / std arrayvec-0_7 bytes-1 hashbrown-0_14 hashbrown-0_15 hashbrown-0_16 hashbrown-0_17 indexmap-2 smallvec-1 smol_str-0_2 smol_str-0_3 thin-vec-0_2 tinyvec-1 triomphe-0_1 uuid-1 (push) Failing after 0s
CI / Features / std bytecheck arrayvec-0_7 bytes-1 hashbrown-0_14 hashbrown-0_15 hashbrown-0_16 hashbrown-0_17 indexmap-2 smallvec-1 smol_str-0_2 smol_str-0_3 thin-vec-0_2 tinyvec-1 triomphe-0_1 uuid-1 (push) Failing after 0s
CI / Toolchain / beta (push) Failing after 0s
CI / Toolchain / nightly (push) Failing after 0s
CI / Toolchain / stable (push) Failing after 0s
CI / Toolchain / beta --release (push) Failing after 0s
CI / Toolchain / nightly --release (push) Failing after 0s
CI / Toolchain / stable --release (push) Failing after 0s
CI / Randomize layout / layout-seed=3141592653589793238 (push) Failing after 0s
CI / Randomize layout / layout-seed=4626433832795028841 (push) Failing after 0s
CI / Randomize layout / layout-seed=9716939937510582097 (push) Failing after 0s
CI / Miri / (push) Failing after 0s
CI / Miri / --release (push) Failing after 0s
CI / Test / (push) Failing after 0s
CI / Test / --release (push) Failing after 0s
CI / Test / aarch64-apple-darwin (push) Failing after 0s
CI / Test / x86_64-unknown-linux-gnu (push) Failing after 0s
CI / Test / x86_64-pc-windows-msvc (push) Failing after 0s
CI / Cross / aarch64-unknown-linux-gnu (push) Failing after 0s
CI / Cross / armv7-unknown-linux-gnueabihf (push) Failing after 0s
CI / Cross / i586-unknown-linux-gnu (push) Failing after 0s
CI / Cross / i686-unknown-linux-gnu (push) Failing after 0s
CI / Cross / thumbv6m-none-eabi (push) Failing after 0s
CI / Format (push) Failing after 0s
CI / Clippy (push) Failing after 0s
CI / Doc (push) Failing after 0s
GitHub Pages / deploy (push) Has been cancelled
Fix B-Tree maps not validating number of entries
Also correct some InlineVec APIs missing restrictions required for soundness.
2026-05-06 20:17:38 -04:00
.cargo Add gitattributes 2024-10-01 09:12:41 -04:00
.github Fix hashbrown-0_16 impl, update features lists 2026-04-15 20:57:40 -04:00
.vscode Fix hashbrown-0_16 impl, update features lists 2026-04-15 20:57:40 -04:00
benchlib Add gitattributes 2024-10-01 09:12:41 -04:00
book_src Link to the examples directory, instead of away from examples (#660) 2026-05-06 20:09:59 -04:00
media Update sponsors 2025-08-11 20:11:34 -04:00
rkyv Fix B-Tree maps not validating number of entries 2026-05-06 20:17:38 -04:00
rkyv_derive Avoid ambiguous associated item references (#646) 2026-01-07 18:44:04 -05:00
rkyv_dyn Improve derive macro attributes 2024-09-08 14:25:36 -04:00
rkyv_dyn_derive Remove most inline attributes 2024-05-12 21:14:17 -04:00
rkyv_dyn_test Improve derive macro attributes 2024-09-08 14:25:36 -04:00
.gitattributes Add gitattributes 2024-10-01 09:12:41 -04:00
.gitignore Update root docs, pare down root re-exports 2024-08-04 20:39:51 -04:00
book.toml Fix mdbook build 2025-12-04 14:38:59 -05:00
Cargo.toml Release 0.8.16 2026-04-22 17:11:32 -04:00
LICENSE Fix external crate support and update license 2021-07-02 16:40:01 -04:00
README.md Update sponsors 2025-08-11 20:11:34 -04:00
rustfmt.toml Finish reformatting, make format failure an error 2024-04-17 19:27:27 -04:00
SECURITY.md Update supported versions 2025-08-11 20:13:38 -04:00

rkyv

rkyv (archive) is a zero-copy deserialization framework for Rust

Discord crates.io docs.rs MIT license

Resources

Learning Materials

  • The rkyv book covers the motivation, architecture, and major features of rkyv
  • The rkyv discord is a great place to get help with specific issues and meet other people using rkyv

Documentation

  • rkyv, the core library
  • rkyv_dyn, which adds trait object support to rkyv

Benchmarks

  • The rust serialization benchmark is a shootout style benchmark comparing many rust serialization solutions. It includes special benchmarks for zero-copy serialization solutions like rkyv.

Sister Crates

  • rend, which rkyv uses for endian-agnostic features
  • bytecheck, which rkyv uses for validation
  • rancor, which rkyv uses for error handling
  • ptr_meta, which rkyv uses for pointer manipulation

Example

use rkyv::{deserialize, rancor::Error, Archive, Deserialize, Serialize};

#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
#[rkyv(
    // This will generate a PartialEq impl between our unarchived
    // and archived types
    compare(PartialEq),
    // Derives can be passed through to the generated type:
    derive(Debug),
)]
struct Test {
    int: u8,
    string: String,
    option: Option<Vec<i32>>,
}

fn main() {
    let value = Test {
        int: 42,
        string: "hello world".to_string(),
        option: Some(vec![1, 2, 3, 4]),
    };

    // Serializing is as easy as a single function call
    let _bytes = rkyv::to_bytes::<Error>(&value).unwrap();

    // Or you can customize your serialization for better performance or control
    // over resource usage
    use rkyv::{api::high::to_bytes_with_alloc, ser::allocator::Arena};

    let mut arena = Arena::new();
    let bytes =
        to_bytes_with_alloc::<_, Error>(&value, arena.acquire()).unwrap();

    // You can use the safe API for fast zero-copy deserialization
    let archived = rkyv::access::<ArchivedTest, Error>(&bytes[..]).unwrap();
    assert_eq!(archived, &value);

    // Or you can use the unsafe API for maximum performance
    let archived =
        unsafe { rkyv::access_unchecked::<ArchivedTest>(&bytes[..]) };
    assert_eq!(archived, &value);

    // And you can always deserialize back to the original type
    let deserialized = deserialize::<Test, Error>(archived).unwrap();
    assert_eq!(deserialized, value);
}

Note: the safe API requires the bytecheck feature (enabled by default) Read more about available features.

Thanks

Thanks to all the sponsors that keep development sustainable.