All Projects → djkoloski → Rkyv

djkoloski / Rkyv

Licence: mit
Zero-copy deserialization framework for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Rkyv

Iguana
universal serialization engine
Stars: ✭ 481 (-18.47%)
Mutual labels:  serialization
Cista
Simple C++ Serialization & Reflection.
Stars: ✭ 535 (-9.32%)
Mutual labels:  serialization
Msgpack Rust
MessagePack implementation for Rust / msgpack.org[Rust]
Stars: ✭ 561 (-4.92%)
Mutual labels:  serialization
Binaryprefs
Rapidly fast and lightweight re-implementation of SharedPreferences which stores each preference in files separately, performs disk operations via NIO with memory mapped byte buffers and works IPC (between processes). Written from scratch.
Stars: ✭ 484 (-17.97%)
Mutual labels:  serialization
Groot
From JSON to Core Data and back.
Stars: ✭ 533 (-9.66%)
Mutual labels:  serialization
Fastjson
A fast JSON parser/generator for Java.
Stars: ✭ 23,997 (+3967.29%)
Mutual labels:  serialization
Airframe
Essential Building Blocks for Scala
Stars: ✭ 442 (-25.08%)
Mutual labels:  serialization
Pbf
A low-level, lightweight protocol buffers implementation in JavaScript.
Stars: ✭ 618 (+4.75%)
Mutual labels:  serialization
Cpp Serializers
Benchmark comparing various data serialization libraries (thrift, protobuf etc.) for C++
Stars: ✭ 533 (-9.66%)
Mutual labels:  serialization
Firely Net Sdk
The official Firely .NET SDK for HL7 FHIR
Stars: ✭ 560 (-5.08%)
Mutual labels:  serialization
Undom
🍩 1kb minimally viable DOM Document implementation
Stars: ✭ 496 (-15.93%)
Mutual labels:  serialization
Bitsery
Your binary serialization library
Stars: ✭ 517 (-12.37%)
Mutual labels:  serialization
Fasteasymapping
A tool for fast serializing & deserializing of JSON
Stars: ✭ 556 (-5.76%)
Mutual labels:  serialization
Quick Xml
Rust high performance xml reader and writer
Stars: ✭ 480 (-18.64%)
Mutual labels:  serialization
Avro4s
Avro schema generation and serialization / deserialization for Scala
Stars: ✭ 593 (+0.51%)
Mutual labels:  serialization
Elle
The Elle coroutine-based asynchronous C++ development framework.
Stars: ✭ 459 (-22.2%)
Mutual labels:  serialization
Hprose Java
Hprose is a cross-language RPC. This project is Hprose 2.0 for Java
Stars: ✭ 542 (-8.14%)
Mutual labels:  serialization
Bridge Deprecated
[DEPRECATED]: Prefer Retrofit/OkHttp by Square, or Fuel for Kotlin
Stars: ✭ 624 (+5.76%)
Mutual labels:  serialization
Colfer
binary serialization format
Stars: ✭ 597 (+1.19%)
Mutual labels:  serialization
Kryo
Java binary serialization and cloning: fast, efficient, automatic
Stars: ✭ 5,247 (+789.32%)
Mutual labels:  serialization

rkyv   Latest Version License requires: rustc 1.47+

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


API Documentation

Book

  • The rkyv book covers the motivation and architecture of rkyv

Sister Crates:

  • bytecheck, which rkyv uses for validation
  • ptr_meta, which rkyv uses for pointer manipulation

rkyv in action

use rkyv::{
    archived_value,
    de::deserializers::AllocDeserializer,
    ser::{
        serializers::WriteSerializer,
        Serializer,
    },
    Archive,
    Serialize,
    Deserialize,
};

#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)]
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]),
    };

    let mut serializer = WriteSerializer::new(Vec::new());
    let pos = serializer.serialize_value(&value).expect("failed to serialize value");
    let buf = serializer.into_inner();

    let archived = unsafe { archived_value::<Test>(buf.as_ref(), pos) };
    assert_eq!(archived.int, value.int);
    assert_eq!(archived.string, value.string);
    assert_eq!(archived.option, value.option);

    let mut deserializer = AllocDeserializer;
    let deserialized = archived.deserialize(&mut deserializer).expect("failed to deserialize value");
    assert_eq!(deserialized, value);
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].