1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
pub use anyhow::{Error, Result};
pub use async_trait::async_trait;

#[doc(hidden)]
pub mod re {
    pub use anyhow::Context;
    pub use bytes::Bytes;
    pub use futures::{future::ready, stream::once, TryStreamExt};
    pub use hyper::{
        service::{make_service_fn, service_fn},
        Body, Request, Response, Server, StatusCode,
    };
    pub use tracing::instrument;
    pub use url::Url;
}

pub type Stream<T> = std::pin::Pin<Box<dyn futures::Stream<Item = Result<T>> + Send + 'static>>;

mod encoding;
mod client;
mod server {
    use crate::Result;
    use async_trait::async_trait;

    //TODO:
    #[async_trait]
    pub trait Rpc<T, O> {
        async fn call(&self, req: T) -> Result<O>;
    }
}

pub use encoding::*;
pub use client::*;
pub use server::*;