pub enum Encoding {
Identity,
Gzip,
Deflate,
Zstd,
}Expand description
A per-message compression codec. Which variants exist depends on the
enabled Cargo features; Identity (no compression) is always present.
Variants§
Identity
No compression.
Gzip
Available on crate feature
gzip only.gzip (flate2), enabled by the gzip feature.
Deflate
Available on crate feature
deflate only.raw DEFLATE (flate2), enabled by the deflate feature.
Zstd
Available on crate feature
zstd only.Zstandard (zstd), enabled by the zstd feature.
Implementations§
Source§impl Encoding
impl Encoding
Sourcepub const ALL: &'static [Self]
pub const ALL: &'static [Self]
Every codec compiled into this build, including Identity. Order
is the order presented in grpc-accept-encoding.
Sourcepub fn from_grpc_encoding(s: &str) -> Option<Self>
pub fn from_grpc_encoding(s: &str) -> Option<Self>
Parse a single grpc-encoding token. Returns None for codecs not
compiled in or values outside the spec set.
Sourcepub fn as_grpc_encoding(&self) -> &'static str
pub fn as_grpc_encoding(&self) -> &'static str
The grpc-encoding token for this codec ("identity", "gzip", …).
Sourcepub fn accepted_encodings() -> &'static str
pub fn accepted_encodings() -> &'static str
Comma-separated list of every codec in this build, suitable for the
grpc-accept-encoding response header. Memoized — the value is
constant for a given build.
Trait Implementations§
impl Copy for Encoding
impl Eq for Encoding
impl StructuralPartialEq for Encoding
Auto Trait Implementations§
impl Freeze for Encoding
impl RefUnwindSafe for Encoding
impl Send for Encoding
impl Sync for Encoding
impl Unpin for Encoding
impl UnsafeUnpin for Encoding
impl UnwindSafe for Encoding
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.