ser_nix 0.1.1

An opinionated nix serialiser for serde.rs
Documentation
use serde::ser;

/// Error type for ser_nix serialisation
#[derive(Debug)]
pub enum Error {
    Message(String),
}

impl ser::Error for Error {
    fn custom<T>(msg: T) -> Self
    where
        T: std::fmt::Display,
    {
        Error::Message(msg.to_string())
    }
}

impl std::fmt::Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        use Error::*;
        match self {
            Message(msg) => f.write_str(&msg),
        }
    }
}

impl std::error::Error for Error {}