Struct HttpInfo

pub struct HttpInfo { /* private fields */ }

Extra information about the transport when an HttpConnector is used.

Example

# fn doc(res: http::Response<()>) {
use hyper_util::client::legacy::connect::HttpInfo;

// res = http::Response
res
    .extensions()
    .get::<HttpInfo>()
    .map(|info| {
        println!("remote addr = {}", info.remote_addr());
    });
# }

Note

If a different connector is used besides HttpConnector, this value will not exist in the extensions. Consult that specific connector to see what "extra" information it might provide to responses.

Implementations

impl HttpInfo

fn remote_addr(&self) -> SocketAddr

Get the remote address of the transport used.

fn local_addr(&self) -> SocketAddr

Get the local address of the transport used.

Trait Implementations

impl Clone for HttpInfo

fn clone(&self) -> HttpInfo

impl Debug for HttpInfo

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl Freeze for HttpInfo

impl RefUnwindSafe for HttpInfo

impl Send for HttpInfo

impl Sync for HttpInfo

impl Unpin for HttpInfo

impl UnsafeUnpin for HttpInfo

impl UnwindSafe for HttpInfo

Blanket Implementations

impl<T> Any for HttpInfo where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for HttpInfo where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for HttpInfo where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for HttpInfo where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for HttpInfo

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for HttpInfo

impl<T> ToOwned for HttpInfo where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> WithSubscriber for HttpInfo

impl<T, U> Into<U> for HttpInfo where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for HttpInfo where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for HttpInfo where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>