pub trait Handle:
'static
+ Copy
+ Send
+ Debug {
// Required methods
fn from_remote_address(remote_addr: RemoteAddress) -> Self;
fn remote_address(&self) -> RemoteAddress;
fn set_remote_address(&mut self, addr: RemoteAddress);
fn local_address(&self) -> LocalAddress;
fn set_local_address(&mut self, addr: LocalAddress);
fn unmapped_eq(&self, other: &Self) -> bool;
fn strict_eq(&self, other: &Self) -> bool;
fn maybe_update(&mut self, other: &Self);
}Expand description
An interface for an object that represents a unique path between two endpoints
Required Methods§
Sourcefn from_remote_address(remote_addr: RemoteAddress) -> Self
fn from_remote_address(remote_addr: RemoteAddress) -> Self
Creates a Handle from a RemoteAddress
Sourcefn remote_address(&self) -> RemoteAddress
fn remote_address(&self) -> RemoteAddress
Returns the remote address for the given handle
Sourcefn set_remote_address(&mut self, addr: RemoteAddress)
fn set_remote_address(&mut self, addr: RemoteAddress)
Updates the remote address to the given value
Sourcefn local_address(&self) -> LocalAddress
fn local_address(&self) -> LocalAddress
Returns the local address for the given handle
Sourcefn set_local_address(&mut self, addr: LocalAddress)
fn set_local_address(&mut self, addr: LocalAddress)
Updates the local address to the given value
Sourcefn unmapped_eq(&self, other: &Self) -> bool
fn unmapped_eq(&self, other: &Self) -> bool
Returns true if the two handles are equal from a network perspective
This function is used to determine if a connection has migrated to another path.
Sourcefn strict_eq(&self, other: &Self) -> bool
fn strict_eq(&self, other: &Self) -> bool
Returns true if the two handles are strictly equal to each other, i.e.
byte-for-byte.
Sourcefn maybe_update(&mut self, other: &Self)
fn maybe_update(&mut self, other: &Self)
Depending on the current value of self, fields from other may be copied to increase the
fidelity of the value.
This is especially useful for clients that initiate a connection only based on the remote IP and port. They likely wouldn’t know the IP address of the local socket. Once a response is received from the server, the IP information will be known at this point and the handle can be updated with the new information.
Implementations should try to limit the cost of updating by checking the current value to see if it needs updating.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.