Help ¿How do you read and understand the meaning of this trait bound?

A while ago I decided to see warp and saw a couple of weird trait bounds from warp that I couldn't understand. Today I stumbled into this function from isahc and decided to ask how do you read / understand the meaning of those type of traits found.

pub fn get<U>(uri: U) -> Result<Response<Body>, Error>
where
    http::Uri: TryFrom<U>,
    <http::Uri as TryFrom<U>>::Error: Into<http::Error>,
{
    HttpClient::shared().get(uri)
}

get can be called on anything that can be fallibly turned into an http::Uri. The second where clause constraint says that the error of trying to convert U into an Uri should be something that can be turned into an http::Error, which is needed because HttpClient::get needs it., which in turn needs it because get_async needs it.

For the Warp case

fn and<F>(self, other: F) -> And<Self, F> where
     // This method will not be available in trait objects
    Self: Sized,
    // The associated type `Extract` is constrained so that it can be a list of multiple types https://docs.rs/hlist/0.1.2/hlist/index.html
    // I find this bound to be overcomplicated and user hostile, but probably useful for them
    <Self::Extract as Tuple>::HList: Combine<<F::Extract as Tuple>::HList>,
    // Just saying that `ohter.clone()` can be called and implements `Filter`
    F: Filter + Clone,
    // Error is likely defined in Filter, so this is the same as `<F as Filter>::Error`?
    // And meas that F can be combined based on whatever CombineRejection is?
    F::Error: CombineRejection<Self::Error>, 
1 Like