1 unstable release

0.1.0 Nov 15, 2024

#864 in Rust patterns

Download history 102/week @ 2024-11-15 7/week @ 2024-11-22 7/week @ 2024-11-29 4/week @ 2024-12-06

120 downloads per month

Custom license

44KB
906 lines

Package sexpr-out

Tools for writing S-Expressions from Rust data.

Example

use objio::{HasOptions, ObjectWriter};
use pretty_assertions::assert_eq;
use sexpr_out::value::Value;
use sexpr_out::writer::{LanguageStyle, Options, Writer};

let writer = Writer::default().pretty_printed(true).with_options(
    Options::default()
        .with_line_width(20)
        .with_style(LanguageStyle::Racket),
);

let list = Value::from(vec![
    Value::from("hello"),
    Value::from("this"),
    Value::from("is"),
    Value::from("a"),
    Value::from("lisp"),
    Value::from("list"),
]);

//           1         2         3
// 0123456789012345678901234567890
// ("hello" "this" "is"
//   "a" "lisp" "list")

assert_eq!(
    writer.write_to_string(&list).unwrap(),
    "(\"hello\" \"this\" \"is\"\n \"a\" \"lisp\" \"list\")".to_string()
);

lib.rs:

One-line description.

More detailed description, with

Example

TBD

Features

Dependencies

~460KB