pub struct RequestStream<'a, T> { /* private fields */ }Expand description
A stream of decoded request messages.
Produced by GrpcServerConn::requests. Read
it with recv (or as a Stream); recv yields Ok(None)
on clean end-of-stream and Err on a decode or transport error.
Implementations§
Trait Implementations§
Source§impl<T: 'static> Stream for RequestStream<'_, T>
impl<T: 'static> Stream for RequestStream<'_, T>
Auto Trait Implementations§
impl<'a, T> Freeze for RequestStream<'a, T>
impl<'a, T> !RefUnwindSafe for RequestStream<'a, T>
impl<'a, T> Send for RequestStream<'a, T>
impl<'a, T> !Sync for RequestStream<'a, T>
impl<'a, T> Unpin for RequestStream<'a, T>
impl<'a, T> UnsafeUnpin for RequestStream<'a, T>
impl<'a, T> !UnwindSafe for RequestStream<'a, T>
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 moreSource§impl<T> Server for Twhere
T: 'static,
impl<T> Server for Twhere
T: 'static,
Source§async fn unary<Req, Resp>(
conn: Conn,
f: impl AsyncFnOnce(&mut GrpcServerConn<Self>, Req) -> Result<Resp, Status>,
) -> Conn
async fn unary<Req, Resp>( conn: Conn, f: impl AsyncFnOnce(&mut GrpcServerConn<Self>, Req) -> Result<Resp, Status>, ) -> Conn
Unary RPC: read exactly one request, await the user function, emit one
response frame followed by
grpc-status trailers.Source§async fn client_streaming<Resp>(
conn: Conn,
f: impl AsyncFnOnce(&mut GrpcServerConn<Self>) -> Result<Resp, Status>,
) -> Conn
async fn client_streaming<Resp>( conn: Conn, f: impl AsyncFnOnce(&mut GrpcServerConn<Self>) -> Result<Resp, Status>, ) -> Conn
Client-streaming RPC: hand the user a
GrpcServerConn from which they read
the request stream (conn.requests::<Req>()); emit the single response
frame and grpc-status trailers.Source§async fn server_streaming<Req, Resp, S>(
conn: Conn,
f: impl AsyncFnOnce(&mut GrpcServerConn<Self>, Req) -> Result<S, Status>,
) -> Conn
async fn server_streaming<Req, Resp, S>( conn: Conn, f: impl AsyncFnOnce(&mut GrpcServerConn<Self>, Req) -> Result<S, Status>, ) -> Conn
Server-streaming RPC: read one request, await the user function for a
response
Stream, then frame each item lazily into the response body
with grpc-status trailers derived from how the stream ended.Source§async fn bidi<Req, Resp, R>(
conn: Conn,
prologue: impl AsyncFnOnce(&mut GrpcServerConn<Self>) -> Result<R, Status>,
) -> Connwhere
Self: Codec<Req> + Codec<Resp>,
Req: Send + 'static,
Resp: Send + 'static,
R: BidiResponder<Req, Resp>,
async fn bidi<Req, Resp, R>(
conn: Conn,
prologue: impl AsyncFnOnce(&mut GrpcServerConn<Self>) -> Result<R, Status>,
) -> Connwhere
Self: Codec<Req> + Codec<Resp>,
Req: Send + 'static,
Resp: Send + 'static,
R: BidiResponder<Req, Resp>,
Bidirectional-streaming RPC — the run-phase prologue. Hand the user a
GrpcServerConn from which they may read early request messages (to decide
response headers) and set initial metadata, then return a
BidiResponder that drives the read-while-write loop after the head is
flushed. Returning Err(Status) rejects before the flush (trailers-only,
no upgrade). See crate::server::bidi for the seam mechanics.Source§impl<S> StreamExt for S
impl<S> StreamExt for S
Source§fn next(&mut self) -> NextFuture<'_, Self>where
Self: Unpin,
fn next(&mut self) -> NextFuture<'_, Self>where
Self: Unpin,
Retrieves the next item in the stream. Read more
Source§fn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self>
fn try_next<T, E>(&mut self) -> TryNextFuture<'_, Self>
Retrieves the next item in the stream. Read more
Source§fn count(self) -> CountFuture<Self>where
Self: Sized,
fn count(self) -> CountFuture<Self>where
Self: Sized,
Counts the number of items in the stream. Read more
Source§fn map<T, F>(self, f: F) -> Map<Self, F>
fn map<T, F>(self, f: F) -> Map<Self, F>
Maps items of the stream to new values using a closure. Read more
Source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Maps items to streams and then concatenates them. Read more
Source§fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
fn then<F, Fut>(self, f: F) -> Then<Self, F, Fut>
Maps items of the stream to new values using an async closure. Read more
Source§fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
Filters and maps items of the stream using a closure. Read more
Source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
Takes only the first
n items of the stream. Read moreSource§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
Skips the first
n items of the stream. Read moreSource§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
Source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
Yields every
stepth item. Read moreSource§fn chain<U>(self, other: U) -> Chain<Self, U>
fn chain<U>(self, other: U) -> Chain<Self, U>
Appends another stream to the end of this one. Read more
Source§fn collect<C>(self) -> CollectFuture<Self, C>
fn collect<C>(self) -> CollectFuture<Self, C>
Collects all items in the stream into a collection. Read more
Source§fn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C>
fn try_collect<T, E, C>(self) -> TryCollectFuture<Self, C>
Collects all items in the fallible stream into a collection. Read more
Source§fn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B>
fn partition<B, P>(self, predicate: P) -> PartitionFuture<Self, P, B>
Partitions items into those for which
predicate is true and those for which it is
false, and then collects them into two collections. Read moreSource§fn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T>
fn fold<T, F>(self, init: T, f: F) -> FoldFuture<Self, F, T>
Accumulates a computation over the stream. Read more
Source§fn try_fold<T, E, F, B>(
&mut self,
init: B,
f: F,
) -> TryFoldFuture<'_, Self, F, B>
fn try_fold<T, E, F, B>( &mut self, init: B, f: F, ) -> TryFoldFuture<'_, Self, F, B>
Accumulates a fallible computation over the stream. Read more
Source§fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
Maps items of the stream to new values using a state value and a closure. Read more
Source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
Enumerates items, mapping them to
(index, item). Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Calls a closure on each item and passes it on. Read more
Source§fn nth(&mut self, n: usize) -> NthFuture<'_, Self>where
Self: Unpin,
fn nth(&mut self, n: usize) -> NthFuture<'_, Self>where
Self: Unpin,
Gets the
nth item of the stream. Read moreSource§fn last(self) -> LastFuture<Self>where
Self: Sized,
fn last(self) -> LastFuture<Self>where
Self: Sized,
Returns the last item in the stream. Read more
Source§fn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P>
fn find<P>(&mut self, predicate: P) -> FindFuture<'_, Self, P>
Source§fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F>
fn find_map<F, B>(&mut self, f: F) -> FindMapFuture<'_, Self, F>
Source§fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P>
fn position<P>(&mut self, predicate: P) -> PositionFuture<'_, Self, P>
Source§fn for_each<F>(self, f: F) -> ForEachFuture<Self, F>
fn for_each<F>(self, f: F) -> ForEachFuture<Self, F>
Calls a closure on each item of the stream. Read more
Source§fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F>
fn try_for_each<F, E>(&mut self, f: F) -> TryForEachFuture<'_, Self, F>
Calls a fallible closure on each item of the stream, stopping on first error. Read more
Source§fn zip<U>(self, other: U) -> Zip<Self, U>
fn zip<U>(self, other: U) -> Zip<Self, U>
Zips up two streams into a single stream of pairs. Read more
Source§fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB>
fn unzip<A, B, FromA, FromB>(self) -> UnzipFuture<Self, FromA, FromB>
Collects a stream of pairs into a pair of collections. Read more
Source§fn race<S>(self, other: S) -> Race<Self, S>
fn race<S>(self, other: S) -> Race<Self, S>
Available on crate features
race and std only.Merges with
other stream, with no preference for either stream when both are ready. Read moreSource§fn drain(&mut self) -> Drain<'_, Self>
fn drain(&mut self) -> Drain<'_, Self>
Yields all immediately available values from a stream. Read more