http_data 0.9.0

Traits for retrieving http data
Documentation
use std::borrow::Borrow;

use crate::data::TlsVersion;

pub trait Method<T: ?Sized> {
    type Target<'a>: Borrow<T>
    where
        Self: 'a;

    fn method(&self) -> Self::Target<'_>;
}

pub trait Uri<T: ?Sized> {
    type Target<'a>: Borrow<T>
    where
        Self: 'a;
    fn uri(&self) -> Self::Target<'_>;
}

pub trait Headers<Name: ?Sized, Value: ?Sized> {
    type N<'n>: Borrow<Name>
    where
        Self: 'n;

    type V<'n>: Borrow<Value>
    where
        Self: 'n;
    fn headers<'s>(&'s self) -> impl Iterator<Item = (Self::N<'s>, Self::V<'s>)>;
}

pub trait Connection<T: ?Sized> {
    type Target<'a>: Borrow<T>
    where
        Self: 'a;
    fn client_socket(&self) -> Self::Target<'_>;
    fn server_socket(&self) -> Self::Target<'_>;
    fn tls_version(&self) -> Option<TlsVersion>;
}