ServerAddress

Trait ServerAddress 

Source
pub trait ServerAddress: Sized {
    // Required methods
    fn size() -> usize;
    fn get(cur: &mut Cursor<'_>) -> Result<Self, Error>;
    fn put(&self, cur: &mut CursorMut<'_>) -> Result<(), Error>;
}
Expand description

Helper trait for dealing with server addresses.

Required Methods§

Source

fn size() -> usize

Size of IP and port in bytes.

Source

fn get(cur: &mut Cursor<'_>) -> Result<Self, Error>

Read address from a cursor.

Source

fn put(&self, cur: &mut CursorMut<'_>) -> Result<(), Error>

Write address to a cursor.

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 ServerAddress for SocketAddrV4

Source§

fn size() -> usize

Source§

fn get(cur: &mut Cursor<'_>) -> Result<Self, Error>

Source§

fn put(&self, cur: &mut CursorMut<'_>) -> Result<(), Error>

Source§

impl ServerAddress for SocketAddrV6

Source§

fn size() -> usize

Source§

fn get(cur: &mut Cursor<'_>) -> Result<Self, Error>

Source§

fn put(&self, cur: &mut CursorMut<'_>) -> Result<(), Error>

Implementors§