Struct StreamSocket

Source
pub struct StreamSocket<P> { /* private fields */ }
Expand description

Provides a stream-oriented socket.

Implementations§

Source§

impl<P: Protocol> StreamSocket<P>

Source

pub fn new(ctx: &IoContext, pro: P) -> Result<StreamSocket<P>>

Source

pub fn async_connect<F>(&self, ep: &P::Endpoint, handler: F) -> F::Output
where F: Handler<(), Error>,

Source

pub fn async_receive<F>( &self, buf: &mut [u8], flags: i32, handler: F, ) -> F::Output
where F: Handler<usize, Error>,

Source

pub fn async_send<F>(&self, buf: &[u8], flags: i32, handler: F) -> F::Output
where F: Handler<usize, Error>,

Source

pub fn available(&self) -> Result<usize>

Source

pub fn bind(&self, ep: &P::Endpoint) -> Result<()>

Source

pub fn cancel(&self)

Source

pub fn connect(&self, ep: &P::Endpoint) -> Result<()>

Source

pub fn get_non_blocking(&self) -> Result<bool>

Source

pub fn get_option<C>(&self) -> Result<C>
where C: GetSocketOption<P>,

Source

pub fn io_control<C>(&self, cmd: &mut C) -> Result<()>
where C: IoControl,

Source

pub fn local_endpoint(&self) -> Result<P::Endpoint>

Source

pub fn receive(&self, buf: &mut [u8], flags: i32) -> Result<usize>

Source

pub fn remote_endpoint(&self) -> Result<P::Endpoint>

Source

pub fn send(&self, buf: &[u8], flags: i32) -> Result<usize>

Source

pub fn set_non_blocking(&self, on: bool) -> Result<()>

Source

pub fn set_option<C>(&self, cmd: C) -> Result<()>
where C: SetSocketOption<P>,

Source

pub fn shutdown(&self, how: Shutdown) -> Result<()>

Trait Implementations§

Source§

impl<P> AsIoContext for StreamSocket<P>

Source§

impl<P> AsRawFd for StreamSocket<P>

Source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
Source§

impl<P: Protocol> Debug for StreamSocket<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Protocol> Socket<P> for StreamSocket<P>

Source§

unsafe fn from_raw_fd(ctx: &IoContext, pro: P, fd: RawFd) -> StreamSocket<P>

Source§

fn protocol(&self) -> P

Source§

impl<P: Protocol> Stream<Error> for StreamSocket<P>

Source§

fn async_read_some<F>(&self, buf: &mut [u8], handler: F) -> F::Output
where F: Handler<usize, Error>,

Source§

fn async_write_some<F>(&self, buf: &[u8], handler: F) -> F::Output
where F: Handler<usize, Error>,

Source§

fn read_some(&self, buf: &mut [u8]) -> Result<usize>

Source§

fn write_some(&self, buf: &[u8]) -> Result<usize>

Source§

impl<P> Send for StreamSocket<P>

Auto Trait Implementations§

§

impl<P> Freeze for StreamSocket<P>
where P: Freeze,

§

impl<P> !RefUnwindSafe for StreamSocket<P>

§

impl<P> !Sync for StreamSocket<P>

§

impl<P> Unpin for StreamSocket<P>
where P: Unpin,

§

impl<P> !UnwindSafe for StreamSocket<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.