Expand description
SIF serialization and deserialization for the Forma framework.
§Quick start
use forma_sif::{from_str, to_string};
use forma_derive::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, PartialEq)]
struct Row {
id: u64,
name: String,
active: bool,
}
// Serialize
let rows = vec![
Row { id: 1, name: "alice".into(), active: true },
Row { id: 2, name: "bob".into(), active: false },
];
let sif = to_string(&rows).unwrap();
assert!(sif.contains("#schema"));
// Deserialize
let back: Vec<Row> = from_str(&sif).unwrap();
assert_eq!(back, rows);Re-exports§
pub use error::Error;
Modules§
Functions§
- from_
document - Deserialize from a pre-parsed SIF document.
- from_
str - Deserialize a sequence of records from a SIF string.
- to_
string - Serialize a value to a SIF string.
- to_
writer - Serialize a value as SIF into a writer.