yew_stdweb/format/
nothing.rs

1//! Contains an implementation of empty serialization format (`Nothing`).
2
3use super::{Binary, Text};
4use anyhow::bail;
5
6/// A representation of an empty data. Nothing stored. Nothing restored.
7#[derive(Debug)]
8pub struct Nothing;
9
10#[allow(clippy::from_over_into)]
11impl Into<Text> for Nothing {
12    fn into(self) -> Text {
13        bail!("nothing")
14    }
15}
16
17impl From<Text> for Nothing {
18    fn from(_: Text) -> Nothing {
19        Nothing
20    }
21}
22
23#[allow(clippy::from_over_into)]
24impl Into<Binary> for Nothing {
25    fn into(self) -> Binary {
26        bail!("nothing")
27    }
28}
29
30impl From<Binary> for Nothing {
31    fn from(_: Binary) -> Nothing {
32        Nothing
33    }
34}