pub struct RouteKey { /* private fields */ }Expand description
Identifies a specific route to a peer.
RouteKey uniquely identifies a connection path by combining the
socket index and remote address.
§Examples
use rust_p2p_core::route::{RouteKey, ConnectProtocol};
// Check the protocol
if route.protocol() == ConnectProtocol::UDP {
println!("UDP route to {}", route.addr());
}Implementations§
Source§impl RouteKey
impl RouteKey
Sourcepub fn protocol(&self) -> ConnectProtocol
pub fn protocol(&self) -> ConnectProtocol
Returns the connection protocol (UDP or TCP).
Sourcepub fn index_usize(&self) -> usize
pub fn index_usize(&self) -> usize
Returns the socket index as usize.
Sourcepub fn addr(&self) -> SocketAddr
pub fn addr(&self) -> SocketAddr
Returns the remote socket address.
Trait Implementations§
Source§impl Ord for RouteKey
impl Ord for RouteKey
Source§impl PartialOrd for RouteKey
impl PartialOrd for RouteKey
Source§impl ToRouteKeyForTcp<()> for &RouteKey
impl ToRouteKeyForTcp<()> for &RouteKey
Source§impl ToRouteKeyForTcp<()> for &mut RouteKey
impl ToRouteKeyForTcp<()> for &mut RouteKey
Source§impl ToRouteKeyForTcp<()> for RouteKey
impl ToRouteKeyForTcp<()> for RouteKey
Source§impl ToRouteKeyForUdp<()> for &RouteKey
impl ToRouteKeyForUdp<()> for &RouteKey
Source§impl ToRouteKeyForUdp<()> for &mut RouteKey
impl ToRouteKeyForUdp<()> for &mut RouteKey
Source§impl ToRouteKeyForUdp<()> for RouteKey
impl ToRouteKeyForUdp<()> for RouteKey
impl Copy for RouteKey
impl Eq for RouteKey
impl StructuralPartialEq for RouteKey
Auto Trait Implementations§
impl Freeze for RouteKey
impl RefUnwindSafe for RouteKey
impl Send for RouteKey
impl Sync for RouteKey
impl Unpin for RouteKey
impl UnwindSafe for RouteKey
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