1 use crate::amf0::errors::{Amf0WriteError, Amf0WriteErrorValue}; 2 use crate::amf0::errors::{Amf0ReadError, Amf0ReadErrorValue}; 3 use failure::{Backtrace, Fail}; 4 use std::fmt; 5 use std::io; 6 7 pub struct NetConnectionError { 8 pub value: NetConnectionErrorValue, 9 } 10 11 pub enum NetConnectionErrorValue { 12 Amf0WriteError(Amf0WriteError), 13 Amf0ReadError(Amf0ReadError), 14 } 15 16 impl From<Amf0WriteError> for NetConnectionError { 17 fn from(error: Amf0WriteError) -> Self { 18 NetConnectionError { 19 value: NetConnectionErrorValue::Amf0WriteError(error), 20 } 21 } 22 } 23 24 impl From<Amf0ReadError> for NetConnectionError { 25 fn from(error: Amf0ReadError) -> Self { 26 NetConnectionError { 27 value: NetConnectionErrorValue::Amf0ReadError(error), 28 } 29 } 30 } 31 32