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
sourceimpl Destination
impl Destination
sourcepub fn try_from_uri(uri: Uri) -> Result<Self>
pub fn try_from_uri(uri: Uri) -> Result<Self>
Try to convert a Uri
into a Destination
Error
Returns an error if the uri contains no authority or no scheme.
sourcepub fn set_scheme(&mut self, scheme: &str) -> Result<()>
pub fn set_scheme(&mut self, scheme: &str) -> Result<()>
sourcepub fn set_port<P>(&mut self, port: P) where
P: Into<Option<u16>>,
pub fn set_port<P>(&mut self, port: P) where
P: Into<Option<u16>>,
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
sourceimpl Clone for Destination
impl Clone for Destination
sourcefn clone(&self) -> Destination
fn clone(&self) -> Destination
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Destination
impl Debug for Destination
Auto Trait Implementations
impl RefUnwindSafe for Destination
impl Send for Destination
impl Sync for Destination
impl Unpin for Destination
impl UnwindSafe for Destination
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more