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
32
//! Contains an implementation of empty serialization format (`Nothing`).

use super::{Binary, Text};
use anyhow::bail;

/// A representation of an empty data. Nothing stored. Nothing restored.
#[derive(Debug)]
pub struct Nothing;

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

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

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

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