Skip to content

Day 24 - gRPC

Tonic

rust
use tonic::{include_proto, service::Interceptor};

mod hello {
    include!("hello.grpc.rs");
}

#[derive(Debug, Default)]
pub struct MyInterceptor;

impl Interceptor for MyInterceptor {}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut app = hello::greeter_server::GreeterServer::add_interceptor(
        MyInterceptor::default(),
    );
    
    Ok(())
}

📅 学习进度

Day主题状态
01-23基础/数据库
24gRPC
25性能优化

本文为Rust 30天学习计划第24天内容

📚 导航

| ← Day 23 - 上一章 | Day 25 - 下一章 →

最后更新: