gowe 0.1.0

Gowe: schema-aware wire format with stateful transport.
Documentation
  • Coverage
  • 0%
    0 out of 317 items documented0 out of 101 items with examples
  • Size
  • Source code size: 289.17 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 16.24 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • minagishl

Gowe (Rust)

Rust implementation of the Gowe 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]
gowe = { git = "https://github.com/gowe-team/gowe-rust.git" }

From crates.io (if/when published):

[dependencies]
gowe = "0.1"

From a local path:

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

Quick start

use gowe::{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 gowe::{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.