Expand description
§Description
This crate is a Rust implementation of the Nameko RPC protocol. It allows to create a RPC service or Rpc Call in Rust that can be called from or to a Nameko microservice.
Girolle mock Nameko architecture to send request and get response.
§Example
§RPC Service
use girolle::{JsonValue::Value, RpcService, Result};
fn hello(s: &[Value]) -> Result<Value> {
// Parse the incomming data
let n: String = serde_json::from_value(s[0].clone())?;
let hello_str: Value = format!("Hello, {}!, by Girolle", n).into();
Ok(hello_str)
}
fn main() {
let mut services: RpcService = RpcService::new("video");
services.insert("hello", hello);
services.start();
}
§RPC Client
use girolle::RpcClient;
#[tokio::main]
async fn main() {
let rpc_call = RpcClient::new();
}
Re-exports§
pub use serde_json as JsonValue;
Modules§
Structs§
- RpcClient
- RpcService
- RpcTask
Type Aliases§
- NamekoFunction
- Result