Trait Address

Source
pub trait Address: Sized + Clone {
    // Required methods
    fn same_host(&self, other: &Self) -> bool;
    fn same(&self, other: &Self) -> bool;
    fn is_broadcast(&self) -> bool;
}
Expand description

An address type, for use with the Socket trait.

Required Methods§

Source

fn same_host(&self, other: &Self) -> bool

Are the two addresses the same host?

For IP based addresses, this checks if the IP of two addresses are the same.

Source

fn same(&self, other: &Self) -> bool

Are the two addresses exactly the same?

For IP based addresses, this checks if the IP and port of two addresses are the same.

Source

fn is_broadcast(&self) -> bool

Is this a broadcast address?

For IP based addresses, checks if this is the IPv4 broadcast address.

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.

Implementations on Foreign Types§

Source§

impl Address for SocketAddr

Source§

fn same_host(&self, other: &SocketAddr) -> bool

Source§

fn same(&self, other: &SocketAddr) -> bool

Source§

fn is_broadcast(&self) -> bool

Source§

impl Address for ()

Source§

fn same_host(&self, _other: &()) -> bool

Source§

fn same(&self, _other: &()) -> bool

Source§

fn is_broadcast(&self) -> bool

Source§

impl Address for SocketAddrV4

Source§

fn same_host(&self, other: &Self) -> bool

Source§

fn same(&self, other: &Self) -> bool

Source§

fn is_broadcast(&self) -> bool

Source§

impl Address for SocketAddrV6

Source§

fn same_host(&self, other: &Self) -> bool

Source§

fn same(&self, other: &Self) -> bool

Source§

fn is_broadcast(&self) -> bool

Implementors§