| Crates.io | armature-grpc |
| lib.rs | armature-grpc |
| version | 0.1.0 |
| created_at | 2025-12-26 22:55:12.322794+00 |
| updated_at | 2025-12-26 22:55:12.322794+00 |
| description | gRPC server and client support for Armature |
| homepage | https://pegasusheavy.github.io/armature |
| repository | https://github.com/pegasusheavy/armature |
| max_upload_size | |
| id | 2006377 |
| size | 81,661 |
gRPC server and client support for the Armature framework.
[dependencies]
armature-grpc = "0.1"
use armature_grpc::{GrpcServer, Request, Response, Status};
pub struct MyService;
#[tonic::async_trait]
impl Greeter for MyService {
async fn say_hello(
&self,
request: Request<HelloRequest>,
) -> Result<Response<HelloReply>, Status> {
let reply = HelloReply {
message: format!("Hello {}!", request.into_inner().name),
};
Ok(Response::new(reply))
}
}
#[tokio::main]
async fn main() {
GrpcServer::builder()
.add_service(GreeterServer::new(MyService))
.serve("0.0.0.0:50051")
.await
.unwrap();
}
use armature_grpc::GrpcClient;
let client = GreeterClient::connect("http://localhost:50051").await?;
let response = client.say_hello(HelloRequest { name: "World".into() }).await?;
println!("Response: {}", response.into_inner().message);
MIT OR Apache-2.0