[go: up one dir, main page]

databake 0.1.0

Trait that lets structs represent themselves as (const) Rust expressions
Documentation

databake crates.io

This crate allows data to write itself into Rust code (bake itself in).

Types that implement the Bake trait can be written into Rust expressions, which allows using Rust code itself as a zero-overhead "serialization" strategy.

Example

use databake::*;
use alloc::borrow::Cow;

let data = [Some((18, Cow::Borrowed("hi")))];
assert_eq!(
    data.bake(&Default::default()).to_string(),
    r#"[Some ((18i32 , :: alloc :: borrow :: Cow :: Borrowed ("hi")))]"#,
);

More Information

For more information on development, authorship, contributing etc. please visit ICU4X home page.