substrate-data 0.3.0

One data model, text syntax, binary form, packed frames and schema system — for any program's files, saves and wire messages.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! [`Sink`]: where the writer's text goes.

/// Where text is written: a `String`, or the bytes of one being built.
pub(super) trait Sink {
    fn text(&mut self, s: &str);
}

impl Sink for String {
    fn text(&mut self, s: &str) {
        self.push_str(s);
    }
}

impl Sink for Vec<u8> {
    fn text(&mut self, s: &str) {
        self.extend_from_slice(s.as_bytes());
    }
}