#[allow(clippy::module_inception)]
mod client;
mod connector;
use crate::{error::ConnectionError, frame};
pub use self::client::{Client, ClientConnection};
pub use self::connector::Connector;
#[derive(thiserror::Error, Debug)]
pub enum ClientError {
#[error("Protocol error: {0}")]
Protocol(Box<ConnectionError>),
#[error("Http/2 codec error: {0}")]
Frame(#[from] frame::FrameError),
#[error("Handshake timeout")]
HandshakeTimeout,
#[error("Connect error: {0}")]
Connect(Box<ntex_connect::ConnectError>),
#[error("Peer disconnected err: {0:?}")]
Disconnected(Option<std::io::Error>),
}
impl From<ConnectionError> for ClientError {
fn from(err: ConnectionError) -> Self {
Self::Protocol(Box::new(err))
}
}
impl From<std::io::Error> for ClientError {
fn from(err: std::io::Error) -> Self {
Self::Disconnected(Some(err))
}
}
impl From<ntex_connect::ConnectError> for ClientError {
fn from(err: ntex_connect::ConnectError) -> Self {
Self::Connect(Box::new(err))
}
}