[][src]Struct protosocks::HasAddr

pub struct HasAddr<T: AsRef<[u8]>> {
    pub field_atyp: usize,
    pub buffer: T,
}

Fields

field_atyp: usizebuffer: T

Implementations

impl<T: AsRef<[u8]>> HasAddr<T>[src]

pub fn new_unchecked(field_atyp: usize, buffer: T) -> HasAddr<T>[src]

Imbue a raw octet buffer with HasAddr packet structure.

pub fn new_checked(field_atyp: usize, buffer: T) -> Result<HasAddr<T>, Error>[src]

Shorthand for a combination of new_unchecked and check_addr_len.

pub fn atyp(&self) -> u8[src]

Return the atyp.

pub fn port(&self) -> u16[src]

Return the dst port of request or bnd port of reply (unchecked).

pub fn parse_atyp(&self) -> Result<Atyp, Error>[src]

Return the atyp.

pub fn check_addr_len(&self) -> Result<(), Error>[src]

Check the length of socks addr.

pub fn take_buffer(self) -> T[src]

impl<'a, T: AsRef<[u8]> + ?Sized> HasAddr<&'a T>[src]

pub fn addr(&self) -> &'a [u8][src]

Return a pointer to the addr (unchecked).

pub fn socks_addr(&self) -> &'a [u8][src]

Return a pointer to the socks addr (atyp, addr, and port) (unchecked).

impl<T: AsRef<[u8]> + AsMut<[u8]>> HasAddr<T>[src]

pub fn set_atyp(&mut self, value: u8)[src]

Set the atyp.

pub fn set_addr(&mut self, value: &[u8])[src]

Set the addr (unchecked).

pub fn set_port(&mut self, value: u16)[src]

Set the port (unchecked).

pub fn set_socks_addr(&mut self, value: &[u8])[src]

Set the socks addr (atyp, addr, and port) (unchecked).

pub fn addr_mut(&mut self) -> &mut [u8][src]

Return a mutable pointer to the addr (unchecked).

pub fn socks_addr_mut(&mut self) -> &mut [u8][src]

Return a mutable pointer to the socks addr (atyp, addr, and port) (unchecked).

Trait Implementations

impl<T: Clone + AsRef<[u8]>> Clone for HasAddr<T>[src]

impl<T: Debug + AsRef<[u8]>> Debug for HasAddr<T>[src]

impl<T: PartialEq + AsRef<[u8]>> PartialEq<HasAddr<T>> for HasAddr<T>[src]

impl<T: AsRef<[u8]>> StructuralPartialEq for HasAddr<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for HasAddr<T> where
    T: RefUnwindSafe

impl<T> Send for HasAddr<T> where
    T: Send

impl<T> Sync for HasAddr<T> where
    T: Sync

impl<T> Unpin for HasAddr<T> where
    T: Unpin

impl<T> UnwindSafe for HasAddr<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.