Files
h2/src/proto/error.rs
Oliver Gould 897bf84163 Use rustfmt to enforce consistent formatting
This change adds a .rustfmt.toml that includes ALL supported settings,
12 of which we have overridden to attempt to cater to our own
proclivities.

rustfmt is checked in the rust-nightly CI job.
2017-09-12 22:29:35 +00:00

35 lines
614 B
Rust

use codec::RecvError;
use frame::Reason;
use std::io;
/// Either an H2 reason or an I/O error
#[derive(Debug)]
pub enum Error {
Proto(Reason),
Io(io::Error),
}
impl Error {
pub fn into_connection_recv_error(self) -> RecvError {
use self::Error::*;
match self {
Proto(reason) => RecvError::Connection(reason),
Io(e) => RecvError::Io(e),
}
}
}
impl From<Reason> for Error {
fn from(src: Reason) -> Self {
Error::Proto(src)
}
}
impl From<io::Error> for Error {
fn from(src: io::Error) -> Self {
Error::Io(src)
}
}