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
impl Endpoint
pub fn id(&self) -> StreamId
pub fn side(&self) -> Side
pub fn split(self) -> (ReadHalf, WriteHalf)
Sourcepub fn rejoin(read: ReadHalf, write: WriteHalf) -> Result<Self>
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.
Sourcepub fn rearm(&mut self, streams: &Streams) -> Result<()>
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.