Skip to main content

Endpoint

Struct Endpoint 

Source
pub struct Endpoint { /* private fields */ }
Expand description

Both ends of one side: what Streams::create and Streams::open return. Reads and writes go through it directly, or Endpoint::split gives the halves to two tasks.

Implementations§

Source§

impl Endpoint

Source

pub fn id(&self) -> StreamId

Source

pub fn side(&self) -> Side

Source

pub fn split(self) -> (ReadHalf, WriteHalf)

Source

pub fn rejoin(read: ReadHalf, write: WriteHalf) -> Result<Self>

Put a split endpoint back together.

For a caller that keeps its streams between exchanges: the halves go out to whoever pumps the bodies and come back here, so the slot is never given up and never claimed again. Neither half is dropped on the way through, so neither terminal flag is set.

Refused if the two halves are not the same side of the same stream, which would otherwise build an endpoint that reads one slot and writes another.

Source

pub fn rearm(&mut self, streams: &Streams) -> Result<()>

Clear this creator-held endpoint for another peer and restore its process-local write state.

Streams::rearm clears the shared directions after side B has let go. An endpoint that sent FIN also remembers that fact locally in its write half, so reusing the slot through the endpoint needs to clear both layers. Keeping that pairing here prevents a caller from successfully rearming SHM and then finding its retained writer still closed.

Only side A, the creator-held side, is reusable. The ticket remains valid because rearming does not change the stream generation.

Source

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

Source

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

Source

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

Source

pub fn blocking_read_chunk(&self, max: usize) -> Result<Bytes>

Source

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

Source

pub fn try_write_exact(&self, buf: &[u8]) -> Result<()>

Source

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

Source

pub fn blocking_write_all(&self, buf: &[u8]) -> Result<()>

Source

pub fn finish(&mut self) -> Result<()>

Source

pub fn reset(&mut self)

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.