reep-id-string 0.2.0

[deprecated] plain string impl. of reep::types::Id with optional serialisation support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use rustc_serialize::{Encoder, Encodable, Decoder, Decodable};
use super::DefaultId;

impl Encodable for DefaultId {
    fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
        s.emit_str(&self.0[..])
    }
}

impl Decodable for DefaultId {
    fn decode<D: Decoder>(d: &mut D) -> Result<Self, D::Error> {
        d.read_str().map( |s| DefaultId(s) )
    }
}