pub enum Target {
None,
Remote(RemoteTarget),
Local(SocketAddr),
}Available on crate feature
client only.Expand description
HTTP target server descriptor
Variants§
None
No target specified
Remote(RemoteTarget)
Remote target, supports service name (domain name by default) or ip address
Local(SocketAddr)
Available on
target_family=unix only.Local target, usually using a unix domain socket.
Implementations§
Source§impl Target
impl Target
Sourcepub const unsafe fn new_host_unchecked(
scheme: Scheme,
host: FastStr,
port: u16,
) -> Self
pub const unsafe fn new_host_unchecked( scheme: Scheme, host: FastStr, port: u16, ) -> Self
Sourcepub const unsafe fn new_addr_unchecked(
scheme: Scheme,
ip: IpAddr,
port: u16,
) -> Self
pub const unsafe fn new_addr_unchecked( scheme: Scheme, ip: IpAddr, port: u16, ) -> Self
Sourcepub fn new_host<S>(
scheme: Option<Scheme>,
host: S,
port: Option<u16>,
) -> Result<Self>
pub fn new_host<S>( scheme: Option<Scheme>, host: S, port: Option<u16>, ) -> Result<Self>
Create a Target through a scheme, host name and a port
Sourcepub fn new_addr(
scheme: Option<Scheme>,
ip: IpAddr,
port: Option<u16>,
) -> Result<Self>
pub fn new_addr( scheme: Option<Scheme>, ip: IpAddr, port: Option<u16>, ) -> Result<Self>
Create a Target through a scheme, ip address and a port
Sourcepub fn set_scheme(&mut self, scheme: Scheme) -> Result<()>
pub fn set_scheme(&mut self, scheme: Scheme) -> Result<()>
Set a new scheme to the Target
Note that if the previous is default port of the previous scheme, the port will be also updated to default port of the new scheme.
Sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
Return if the Target is Target::None
Sourcepub fn remote_ref(&self) -> Option<&RemoteTarget>
pub fn remote_ref(&self) -> Option<&RemoteTarget>
Get a reference of the RemoteTarget.
Sourcepub fn remote_mut(&mut self) -> Option<&mut RemoteTarget>
pub fn remote_mut(&mut self) -> Option<&mut RemoteTarget>
Get a mutable reference of the RemoteTarget.
Sourcepub fn remote_host(&self) -> Option<&FastStr>
pub fn remote_host(&self) -> Option<&FastStr>
Return the remote host name if the Target is a host name.
Sourcepub fn unix_socket_addr(&self) -> Option<&SocketAddr>
Available on target_family=unix only.
pub fn unix_socket_addr(&self) -> Option<&SocketAddr>
target_family=unix only.Return the unix socket address if the Target is it.
Trait Implementations§
Source§impl Apply<ClientContext> for Target
impl Apply<ClientContext> for Target
Auto Trait Implementations§
impl !Freeze for Target
impl RefUnwindSafe for Target
impl Send for Target
impl Sync for Target
impl Unpin for Target
impl UnwindSafe for Target
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more