Expand description

norpc is a library to implement in-process microservices.

#[norpc::service]
trait HelloWorld {
   fn hello(s: String) -> String;
}
struct HelloWorldApp;
#[async_trait::async_trait]
impl HelloWorld for HelloWorldApp {
   async fn hello(&self, s: String) -> String {
       format!("Hello, {}", s)
   }
}
let rep = tokio_test::block_on(async {
    use norpc::runtime::*;
    let app = HelloWorldApp;
    let svc = HelloWorldService::new(app);
    let (chan, server) = ServerBuilder::new(svc).build();
    ::tokio::spawn(server.serve(TokioExecutor));
    let mut cli = HelloWorldClient::new(chan);
    cli.hello("World".to_owned()).await
});
assert_eq!(rep, "Hello, World");

Modules

runtimeruntime

Runtime implementation.

Attribute Macros

Macro for code-generation.