Skip to content

Commit

Permalink
feat: add new method get_uri for Endpoint (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherlock-Holo committed Jun 16, 2020
1 parent 7610294 commit 54d7a7a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tonic/src/transport/channel/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 54d7a7a

Please sign in to comment.