muesli

Crates.iomuesli
lib.rsmuesli
version0.0.2
sourcesrc
created_at2024-09-21 06:07:51.177994
updated_at2024-09-21 14:08:46.796894
descriptionhealthy implementation of PHP's serialization and session formats in Rust
homepage
repositoryhttps://github.com/vvvinceocam/muesli
max_upload_size
id1381972
size176,560
vvvince (vvvinceocam)

documentation

README

a lively bowl of muesli

muesli

healthy implementation of PHP's serialization and session formats in Rust

Made With Rust Crates.io Docs.rs

muesli is Rust implementation of PHP's serialize(), unserialize(), session_encode(), and session_decode() functions.

Installation

Add this to your Cargo.toml:

[dependencies]
muesli = "0.0.2"

or run:

cargo add muesli

Usage

use muesli::{session_encode, SessionEntry, Value};

fn main() {
    let data = vec![
        SessionEntry {
            key: b"foo",
            value: Value::Integer(42),
        },
        SessionEntry {
            key: b"bar",
            value: Value::String(b"baz|qux".as_slice()),
        },
        SessionEntry {
            key: b"pub",
            value: Value::Integer(1337),
        },
    ];

    let mut session = Vec::<u8>::new();
    session_encode(&mut session, &data).unwrap();
    assert_eq!(session, b"foo|i:42;bar|s:7:\"baz|qux\";pub|i:1337;".as_slice());
}

Rust Version Compatibility

Compiler support: requires rustc 1.79.0+

Development

An automated development environment is provided through devenv tool. It's the preferred way to work on muesli.

Main development loop

The devenv shell provides the devloop command that run linters, tests and build command on files changes:

devloop
Commit count: 9

cargo fmt