Factor out date serde into newtype

This commit is contained in:
Dominik Werder
2022-11-23 10:38:07 +01:00
parent 9f97316caf
commit 694ec7ea98
5 changed files with 119 additions and 93 deletions

View File

@@ -4,6 +4,7 @@ Error handling and reporting.
use serde::{Deserialize, Serialize};
use std::array::TryFromSliceError;
use std::convert::Infallible;
use std::fmt;
use std::net::AddrParseError;
use std::num::{ParseFloatError, ParseIntError};
@@ -239,6 +240,12 @@ impl From<PublicError> for Error {
}
}
impl ToErr for Infallible {
fn to_err(self) -> Error {
Error::with_msg_no_trace(String::new())
}
}
impl From<String> for Error {
fn from(k: String) -> Self {
Self::with_msg(k)