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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use std::fmt::Display;

use serde::{
    de::{Expected, Unexpected},
    ser::Error,
};

use crate::{QError, QErrorKind};

impl Error for QError {
    fn custom<T>(msg: T) -> Self
    where
        T: Display,
    {
        QError { error: Box::new(QErrorKind::Custom(msg.to_string())), level: Default::default(), source: None }
    }
}

#[allow(unused_variables)]
impl serde::de::Error for QError {
    fn custom<T>(msg: T) -> Self
    where
        T: Display,
    {
        Error::custom(msg)
    }

    fn invalid_type(unexp: Unexpected, exp: &dyn Expected) -> Self {
        todo!()
    }

    fn invalid_value(unexp: Unexpected, exp: &dyn Expected) -> Self {
        todo!()
    }

    fn invalid_length(len: usize, exp: &dyn Expected) -> Self {
        todo!()
    }

    fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self {
        todo!()
    }

    fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self {
        todo!()
    }

    fn missing_field(field: &'static str) -> Self {
        todo!()
    }

    fn duplicate_field(field: &'static str) -> Self {
        todo!()
    }
}