1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//! Contains an implementation of empty serialization format (`Nothing`).

use super::{Binary, Text};
use failure::err_msg;

/// A representation of an empty data. Nothing stored. Nothing restored.
pub struct Nothing;

impl Into<Text> for Nothing {
    fn into(self) -> Text {
        Err(err_msg("nothing"))
    }
}

impl From<Text> for Nothing {
    fn from(_: Text) -> Nothing {
        Nothing
    }
}

impl Into<Binary> for Nothing {
    fn into(self) -> Binary {
        Err(err_msg("nothing"))
    }
}

impl From<Binary> for Nothing {
    fn from(_: Binary) -> Nothing {
        Nothing
    }
}