pub struct StreamPeer<R, W> { /* private fields */ }Expand description
A peer at the other end of a connection, where serve answers.
input is what the other end sends, and output is what it reads. An
answer that is left half read, because a frame of it was refused, leaves
the connection where nobody knows what comes next. Nothing more is asked
on it then: open a new one.
Implementations§
Trait Implementations§
Source§impl<R: Read, W: Write> Peer for StreamPeer<R, W>
impl<R: Read, W: Write> Peer for StreamPeer<R, W>
Source§fn ask(
&mut self,
request: &[u8],
limit: usize,
on_frame: &mut dyn FnMut(&[u8]) -> Result<()>,
) -> Result<()>
fn ask( &mut self, request: &[u8], limit: usize, on_frame: &mut dyn FnMut(&[u8]) -> Result<()>, ) -> Result<()>
Sends one request, and hands each frame of the answer to
on_frame
in the order the frames come. An error from on_frame ends the
answer, and is what ask returns. Read moreSource§fn ask_all(
&mut self,
requests: &[(Vec<u8>, usize)],
on_frame: &mut dyn FnMut(usize, &[u8]) -> Result<()>,
) -> Result<()>
fn ask_all( &mut self, requests: &[(Vec<u8>, usize)], on_frame: &mut dyn FnMut(usize, &[u8]) -> Result<()>, ) -> Result<()>
Sends several requests, each with its limit, and hands each frame to
on_frame with the place of the request that it answers. Answers
come in the order of the requests. Read moreAuto Trait Implementations§
impl<R, W> Forget for StreamPeer<R, W>
impl<R, W> Freeze for StreamPeer<R, W>
impl<R, W> Move for StreamPeer<R, W>
impl<R, W> RefUnwindSafe for StreamPeer<R, W>where
R: RefUnwindSafe,
W: RefUnwindSafe,
impl<R, W> Send for StreamPeer<R, W>
impl<R, W> Sync for StreamPeer<R, W>
impl<R, W> Unpin for StreamPeer<R, W>
impl<R, W> UnsafeUnpin for StreamPeer<R, W>where
R: UnsafeUnpin,
W: UnsafeUnpin,
impl<R, W> UnwindSafe for StreamPeer<R, W>where
R: UnwindSafe,
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more