Vendored version of rkyv from crates.io
- Rust 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
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
Also correct some InlineVec APIs missing restrictions required for soundness. |
||
| .cargo | ||
| .github | ||
| .vscode | ||
| benchlib | ||
| book_src | ||
| media | ||
| rkyv | ||
| rkyv_derive | ||
| rkyv_dyn | ||
| rkyv_dyn_derive | ||
| rkyv_dyn_test | ||
| .gitattributes | ||
| .gitignore | ||
| book.toml | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
| rustfmt.toml | ||
| SECURITY.md | ||
rkyv (archive) is a zero-copy deserialization framework for Rust
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
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.