feat: add new method get_uri for Endpoint (#371)

This commit is contained in:
Sherlock Holo
2020-06-16 18:22:12 -04:00
committed by GitHub
parent 761029444f
commit 54d7a7af6b
+13
View File
@@ -226,6 +226,19 @@ impl Endpoint {
Channel::connect(connector, self.clone()).await
}
/// Get the endpoint uri.
///
/// ```
/// # use tonic::transport::Endpoint;
/// # use http::Uri;
/// let endpoint = Endpoint::from_static("https://example.com");
///
/// assert_eq!(endpoint.get_uri(), &Uri::from_static("https://example.com"));
/// ```
pub fn get_uri(&self) -> &Uri {
&self.uri
}
}
impl From<Uri> for Endpoint {