Skip to main content

Operation

Enum Operation 

Source
#[non_exhaustive]
pub enum Operation { Accept { listener: Token, }, Receive { token: Token, buffer: Buffer, }, ReceiveZero { token: Token, }, Send { token: Token, chunks: SendChunks, }, SendFile { token: Token, file: Arc<File>, offset: u64, len: u32, }, Connect { token: Token, addr: SocketAddr, }, Close { token: Token, abortive: bool, }, Nop { token: Token, }, }
Expand description

What to do on a registered socket. The operation owns its buffers until its completion returns them.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Accept

Completes when a connection is waiting (accept it from the listener). Refused on Windows, where a listener is never registered (D-016).

Fields

§listener: Token

The listener.

§

Receive

Receives into buffer’s spare room (at most once); Ok(0) is end of stream.

Fields

§token: Token

The socket.

§buffer: Buffer

Where the bytes land; returned by the completion.

§

ReceiveZero

Completes when bytes can be read, without holding a buffer: idle connections wait this way.

Fields

§token: Token

The socket.

§

Send

Sends what chunks holds; the result says how many bytes went out, which can be fewer than all of them. The chunks come back with the completion.

Fields

§token: Token

The socket.

§chunks: SendChunks

The bytes.

§

SendFile

Sends up to len bytes of file from offset, zero copy where the OS can. The result says how many went out; Ok(0) means the file has nothing there.

Fields

§token: Token

The socket.

§file: Arc<File>

The file; held until the completion.

§offset: u64

Where to start.

§len: u32

The most to send.

§

Connect

Connects a registered, non-blocking socket.

Fields

§token: Token

The socket.

§addr: SocketAddr

The peer.

§

Close

Completes once every other operation on the socket has; the caller then closes it. Abortive when asked (linger 0).

Fields

§token: Token

The socket.

§abortive: bool

Reset instead of FIN.

§

Nop

Completes at once (a turn of the loop).

Fields

§token: Token

Echoed in the completion.

Trait Implementations§

Source§

impl Debug for Operation

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.