1pub mod codegen;
19pub mod common;
20mod framework;
21pub mod invocation;
22pub mod protocol;
23pub mod registry;
24pub mod status;
25pub mod triple;
26pub mod utils;
27
28use http_body::Body;
29use std::future::Future;
30use std::pin::Pin;
31
32pub use framework::Dubbo;
33
34pub type StdError = Box<dyn std::error::Error + Send + Sync + 'static>;
35pub type BoxFuture<T, E> = self::Pin<Box<dyn self::Future<Output = Result<T, E>> + Send + 'static>>;
36pub(crate) type Error = Box<dyn std::error::Error + Send + Sync>;
37pub type BoxBody = http_body::combinators::UnsyncBoxBody<bytes::Bytes, self::status::Status>;
38
39pub fn empty_body() -> BoxBody {
40 http_body::Empty::new()
41 .map_err(|err| match err {})
42 .boxed_unsync()
43}
44
45pub(crate) fn boxed<B>(body: B) -> BoxBody
46where
47 B: http_body::Body<Data = bytes::Bytes> + Send + 'static,
48 B::Error: Into<self::Error>,
49{
50 body.map_err(|err| {
51 self::status::Status::new(self::status::Code::Internal, format!("{:?}", err.into()))
52 })
53 .boxed_unsync()
54}