2021-08-12 15:35:15 +02:00
|
|
|
mod client;
|
|
|
|
mod transport;
|
2021-08-16 06:22:54 +02:00
|
|
|
mod types;
|
2021-08-12 15:35:15 +02:00
|
|
|
|
2021-08-16 06:22:54 +02:00
|
|
|
pub use client::Client;
|
2021-08-12 15:35:15 +02:00
|
|
|
pub use transport::{Event, Payload, Request, Response, Transport};
|
2021-08-16 06:22:54 +02:00
|
|
|
pub use types::*;
|
2021-08-12 15:35:15 +02:00
|
|
|
|
|
|
|
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum Error {
|
|
|
|
#[error("failed to parse: {0}")]
|
|
|
|
Parse(#[from] serde_json::Error),
|
|
|
|
#[error("IO Error: {0}")]
|
|
|
|
IO(#[from] std::io::Error),
|
|
|
|
#[error("request timed out")]
|
|
|
|
Timeout,
|
|
|
|
#[error("server closed the stream")]
|
|
|
|
StreamClosed,
|
|
|
|
#[error(transparent)]
|
|
|
|
Other(#[from] anyhow::Error),
|
|
|
|
}
|
|
|
|
pub type Result<T> = core::result::Result<T, Error>;
|