pub struct Destination { /* private fields */ }
Expand description

A set of properties to describe where and how to try to connect.

This type is passed an argument for the Connect trait.

Implementations

Try to convert a Uri into a Destination

Error

Returns an error if the uri contains no authority or no scheme.

Get the protocol scheme.

Get the hostname.

Get the port, if specified.

Update the scheme of this destination.

Example
// let mut dst = some_destination...
// Change from "http://"...
assert_eq!(dst.scheme(), "http");

// to "ws://"...
dst.set_scheme("ws");
assert_eq!(dst.scheme(), "ws");
Error

Returns an error if the string is not a valid scheme.

Update the host of this destination.

Example
// let mut dst = some_destination...
// Change from "hyper.rs"...
assert_eq!(dst.host(), "hyper.rs");

// to "some.proxy"...
dst.set_host("some.proxy");
assert_eq!(dst.host(), "some.proxy");
Error

Returns an error if the string is not a valid hostname.

Update the port of this destination.

Example
// let mut dst = some_destination...
// Change from "None"...
assert_eq!(dst.port(), None);

// to "4321"...
dst.set_port(4321);
assert_eq!(dst.port(), Some(4321));

// Or remove the port...
dst.set_port(None);
assert_eq!(dst.port(), None);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.