grass_runtime/property/
io.rs

1use std::io::{Result, Write};
2
3pub trait Parsable<'a>: Sized {
4    fn parse(s: &'a str) -> Option<(Self, usize)>;
5}
6
7pub trait Serializable {
8    fn dump<W: Write>(&self, fp: W) -> Result<()>;
9}
10
11impl<A: Serializable, B: Serializable> Serializable for (A, B) {
12    fn dump<W: Write>(&self, mut fp: W) -> Result<()> {
13        self.0.dump(&mut fp)?;
14        write!(fp, "\t")?;
15        self.1.dump(&mut fp)
16    }
17}