Skip to content

recurram/recurram-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recurram (Rust)

Rust implementation of the Recurram wire format and session-aware encoder/decoder.

What this crate provides

  • Dynamic encoding/decoding (encode, decode)
  • Schema-aware encoding (encode_with_schema)
  • Batch and micro-batch encoding (encode_batch, SessionEncoder::encode_micro_batch)
  • Stateful features (base snapshots, state patch, template batch, control stream, trained dictionary)

Requirements

  • Rust stable (edition 2024)

Install

Add one of the following to Cargo.toml.

From GitHub:

[dependencies]
recurram = { git = "https://github.com/recurram/recurram-rust.git" }

From crates.io (if/when published):

[dependencies]
recurram = "0.1"

From a local path:

[dependencies]
recurram = { path = "./recurram-rust" }

Quick start

use recurram::{decode, encode, Value};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let value = Value::Map(vec![
        ("id".to_string(), Value::U64(1001)),
        ("name".to_string(), Value::String("alice".to_string())),
    ]);

    let bytes = encode(&value)?;
    let decoded = decode(&bytes)?;
    assert_eq!(decoded, value);
    Ok(())
}

Session encoder example

use recurram::{create_session_encoder, SessionOptions, Value};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut enc = create_session_encoder(SessionOptions::default());

    let value = Value::Map(vec![
        ("id".to_string(), Value::U64(1)),
        ("role".to_string(), Value::String("admin".to_string())),
    ]);

    let _bytes = enc.encode(&value)?;
    Ok(())
}

Development

Run checks locally:

cargo fmt --all
cargo test

Release (GitHub Actions)

Publishing to crates.io is automated by .github/workflows/publish-crates.yml.

Setup:

  1. Add repository secret CARGO_REGISTRY_TOKEN (crates.io API token).
  2. Bump version in Cargo.toml.
  3. Create and push a matching tag: v<version>.

Example:

git tag v0.1.0
git push origin v0.1.0

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Rust implementation of a fast, compact binary wire format for modern data transport.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages