diff --git a/tonic/src/transport/channel/endpoint.rs b/tonic/src/transport/channel/endpoint.rs index 13eb4b986..fb9d0c496 100644 --- a/tonic/src/transport/channel/endpoint.rs +++ b/tonic/src/transport/channel/endpoint.rs @@ -13,6 +13,7 @@ use http::{ use std::{ convert::{TryFrom, TryInto}, fmt, + str::FromStr, time::Duration, }; use tower::make::MakeConnection; @@ -351,3 +352,11 @@ impl fmt::Debug for Endpoint { f.debug_struct("Endpoint").finish() } } + +impl FromStr for Endpoint { + type Err = InvalidUri; + + fn from_str(s: &str) -> Result { + Self::try_from(s.to_string()) + } +}