/rust/registry/src/index.crates.io-1949cf8c6b5b557f/tonic-0.12.3/src/extensions.rs
Line | Count | Source |
1 | | /// A gRPC Method info extension. |
2 | | #[derive(Debug, Clone)] |
3 | | pub struct GrpcMethod<'a> { |
4 | | service: &'a str, |
5 | | method: &'a str, |
6 | | } |
7 | | |
8 | | impl<'a> GrpcMethod<'a> { |
9 | | /// Create a new `GrpcMethod` extension. |
10 | | #[doc(hidden)] |
11 | 0 | pub fn new(service: &'a str, method: &'a str) -> Self { |
12 | 0 | Self { service, method } |
13 | 0 | } |
14 | | |
15 | | /// gRPC service name |
16 | 0 | pub fn service(&self) -> &str { |
17 | 0 | self.service |
18 | 0 | } |
19 | | /// gRPC method name |
20 | 0 | pub fn method(&self) -> &str { |
21 | 0 | self.method |
22 | 0 | } |
23 | | } |