sheave_core/messages/amf/
inconsistent_marker.rs1use std::{
2 error::Error,
3 fmt::{
4 Display,
5 Formatter,
6 Result as FormatResult
7 },
8 io::{
9 Error as IOError,
10 ErrorKind
11 }
12};
13
14#[derive(Debug)]
16pub struct InconsistentMarker {
17 expected: u8,
18 actual: u8
19}
20
21impl InconsistentMarker {
22 pub fn new(expected: u8, actual: u8) -> Self {
24 Self { expected, actual }
25 }
26}
27
28impl Display for InconsistentMarker {
29 fn fmt(&self, f: &mut Formatter<'_>) -> FormatResult {
30 writeln!(f, "Marker is inconsistent. expected: {}, actual: {}", self.expected, self.actual)
31 }
32}
33
34impl Error for InconsistentMarker {}
35
36pub fn inconsistent_marker(expected: u8, actual: u8) -> IOError {
38 IOError::new(
39 ErrorKind::InvalidData,
40 InconsistentMarker {
41 expected,
42 actual
43 }
44 )
45}