#![deny(missing_docs, missing_debug_implementations, unused_extern_crates)]
use std::error;
use std::fmt;
pub mod base64_format;
pub use base64_format::ByteArray;
pub mod nullable_format;
pub use nullable_format::Nullable;
pub mod auth;
pub use auth::{AuthData, Authorization};
pub mod context;
pub use context::{
ContextBuilder, ContextWrapper, ContextualPayload, EmptyContext, Has, Pop, Push,
};
pub mod client;
pub mod connector;
pub use connector::Connector;
pub mod composites;
pub use composites::{CompositeMakeService, CompositeService, NotFound};
pub mod add_context;
pub use add_context::{AddContextMakeService, AddContextService};
pub mod drop_context;
pub use drop_context::{DropContextMakeService, DropContextService};
pub mod request_parser;
pub use request_parser::RequestParser;
mod header;
pub use header::{IntoHeaderValue, XSpanIdString, X_SPAN_ID};
#[cfg(feature = "multipart")]
pub mod multipart;
pub trait ErrorBound: Into<Box<dyn std::error::Error + Send + Sync>> {}
impl<T> ErrorBound for T where T: Into<Box<dyn std::error::Error + Send + Sync>> {}
#[derive(Clone, Debug)]
pub struct ApiError(pub String);
impl fmt::Display for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let debug: &dyn fmt::Debug = self;
debug.fmt(f)
}
}
impl error::Error for ApiError {
fn description(&self) -> &str {
"Failed to produce a valid response."
}
}
impl<'a> From<&'a str> for ApiError {
fn from(e: &str) -> Self {
ApiError(e.to_string())
}
}
impl From<String> for ApiError {
fn from(e: String) -> Self {
ApiError(e)
}
}
#[cfg(feature = "serdejson")]
impl From<serde_json::Error> for ApiError {
fn from(e: serde_json::Error) -> Self {
ApiError(format!("Response body did not match the schema: {}", e))
}
}