Expand description

Serialization module for most possible types. Tuples are limited between (A, B) and (A, B, C, D, E, F), any other tuple needs to be implemented by the trait Serialize. This module requires #[macro_use] for structs.

Example:

use std::collections::{BTreeMap, BTreeSet};
use edn_derive::Serialize;
use edn_rs::{set, map, edn::Edn};

#[derive(Serialize)]
struct ExampleEdn {
    map: BTreeMap<String, Vec<String>>,
    set: BTreeSet<i64>,
    tuples: (i32, bool, char),
}
fn main() {
    let edn = ExampleEdn {
        map: map!{"this is a key".to_string() => vec!["with".to_string(), "many".to_string(), "keys".to_string()]},
        set: set!{3i64, 4i64, 5i64},
        tuples: (3i32, true, 'd')
    };
    println!("{}", edn_rs::to_string(edn));
    // { :map {:this-is-a-key ["with", "many", "keys"]}, :set #{3, 4, 5}, :tuples (3, true, \d), }
}

Traits

Trait that allows you to implement Serialization for each type of your choice. Example: