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
use std::io;
use byteorder;
use lzma;
#[derive(Debug)]
pub enum Error {
IoError(io::Error),
NotSwf
}
impl From<io::Error> for Error {
fn from(err: io::Error) -> Self {
Error::IoError(err)
}
}
impl From<byteorder::Error> for Error {
fn from(err: byteorder::Error) -> Self {
use byteorder::Error::*;
match err {
UnexpectedEOF => Error::NotSwf,
Io(error) => error.into()
}
}
}
impl From<lzma::Error> for Error {
fn from(err: lzma::Error) -> Self {
use lzma::Error::*;
match err {
IO(error) => error.into(),
ByteOrder(error) => error.into(),
_ => Error::NotSwf
}
}
}