#[non_exhaustive]pub enum Compression {
Raw,
Zstd,
Auto,
}Expand description
Compression negotiation vocabulary.
Drives the X-QWP-Accept-Encoding header the client sends on the
WebSocket upgrade (Self::header_token returns the wire token).
The server picks one codec from the advertised set and echoes its
choice back in X-QWP-Content-Encoding; subsequent RESULT_BATCH
frames are tagged with FLAG_ZSTD (or not) accordingly.
All three variants are usable end-to-end when the client is built
with the sync-reader-zstd feature (which almost-all-features
turns on by default). Without that feature, Zstd / Auto still
compile but the decoder rejects any FLAG_ZSTD batch the server
sends back with ErrorCode::UnsupportedServer — surface the
error to the operator rather than silently mis-decoding a
compressed payload as raw wire bytes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Raw
Advertise raw only — every RESULT_BATCH body is
uncompressed wire bytes. Works on every client build (no
sync-reader-zstd dependency).
Zstd
Advertise zstd only — the server must send compressed
batches and the client must be built with the
sync-reader-zstd feature to decode them.
Auto
Advertise both zstd,raw — the server picks. The decoder
handles either path. If the client was built without the
sync-reader-zstd feature and the server still selects
zstd, the decoder rejects the first FLAG_ZSTD batch with
UnsupportedServer; the operator’s recovery is to enable the
feature or pin Compression::Raw.
Implementations§
Source§impl Compression
impl Compression
Sourcepub fn accept_encoding(self, level: u8) -> String
pub fn accept_encoding(self, level: u8) -> String
Wire value for the X-QWP-Accept-Encoding header. Wire-egress.md
§3: zstd carries an optional level=N hint that the server
clamps to [1, 9]; raw has no parameters. Auto advertises
zstd;level=N,raw (first match wins, per spec). level is
ignored for Raw.
Sourcepub fn header_token(self) -> &'static str
pub fn header_token(self) -> &'static str
Bare codec token without the level= parameter — useful for
diagnostics and the (now-rare) callers that want to log just
“raw” / “zstd” / “zstd,raw”. The on-wire value the client
actually advertises is built by Self::accept_encoding.
Trait Implementations§
Source§impl Clone for Compression
impl Clone for Compression
Source§fn clone(&self) -> Compression
fn clone(&self) -> Compression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Compression
Source§impl Debug for Compression
impl Debug for Compression
impl Eq for Compression
Source§impl PartialEq for Compression
impl PartialEq for Compression
impl StructuralPartialEq for Compression
Auto Trait Implementations§
impl Freeze for Compression
impl RefUnwindSafe for Compression
impl Send for Compression
impl Sync for Compression
impl Unpin for Compression
impl UnsafeUnpin for Compression
impl UnwindSafe for Compression
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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
key and return true if they are equal.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> ⓘ
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> ⓘ
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