blob: b9d765db591da039c10ad9f1b7b2e7f05de29959 (
plain)
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
|
use crate::{ArchiveError, ArchiveResult};
use std::error::Error;
use std::fmt::Display;
pub type StructResult<T> = ArchiveResult<T, StructError>;
#[derive(Debug)]
pub enum StructError {
IncorrectEnumVariant,
}
impl From<StructError> for ArchiveError<StructError> {
fn from(value: StructError) -> Self {
Self::Archivator {
module: "Struct serializer".to_string(),
error: value,
}
}
}
impl Display for StructError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
StructError::IncorrectEnumVariant => write!(f, "Can't cast enum variant type"),
}
}
}
impl Error for StructError {}
|