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
use std::io;
use std::error;
use std::fmt;
#[derive(Debug)]
pub enum SeekError {
OutOfBounds(u32),
Io(io::Error),
}
impl fmt::Display for SeekError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
SeekError::OutOfBounds(v) => write!(f, "Position out of bounds {:?}", v),
SeekError::Io(ref v) => fmt::Display::fmt(v, f),
}
}
}
impl error::Error for SeekError {
fn description(&self) -> &str {
match *self {
SeekError::OutOfBounds(_) => "out of bounds",
SeekError::Io(ref e) => error::Error::description(e),
}
}
}