tonic/
extensions.rs

1/// A gRPC Method info extension.
2#[derive(Debug, Clone)]
3pub struct GrpcMethod<'a> {
4    service: &'a str,
5    method: &'a str,
6}
7
8impl<'a> GrpcMethod<'a> {
9    /// Create a new `GrpcMethod` extension.
10    #[doc(hidden)]
11    pub fn new(service: &'a str, method: &'a str) -> Self {
12        Self { service, method }
13    }
14
15    /// gRPC service name
16    pub fn service(&self) -> &str {
17        self.service
18    }
19    /// gRPC method name
20    pub fn method(&self) -> &str {
21        self.method
22    }
23}