pub enum StreamEncoding {
Identity,
Deflate12c,
Zstd20c,
}Expand description
One direction’s stream encoding, named by its preface token.
Variants§
Identity
Plain ILTP bytes. Always available and implied by every offer.
Deflate12c
Raw deflate (RFC 1951) with a 4 KiB window, sync flushes and the preset dictionary.
Zstd20c
Magicless zstd (RFC 8878) with at most a 1 MiB window, no checksum, content size or dictionary ID, and the raw-content preset dictionary.
Implementations§
Source§impl StreamEncoding
impl StreamEncoding
Sourcepub const COMPILED: &'static [StreamEncoding]
pub const COMPILED: &'static [StreamEncoding]
Compiled-in compressed encodings, most preferred first.
pub fn token(self) -> &'static str
Sourcepub fn from_token(token: &str) -> Option<StreamEncoding>
pub fn from_token(token: &str) -> Option<StreamEncoding>
Parse a token; tokens unknown to this build return None.
Sourcepub fn parse_list<'a>(
tokens: impl IntoIterator<Item = &'a str>,
) -> Result<Vec<StreamEncoding>, &'static str>
pub fn parse_list<'a>( tokens: impl IntoIterator<Item = &'a str>, ) -> Result<Vec<StreamEncoding>, &'static str>
Parse one configured token list: the encode preference and decode set
of a carrier. Tokens unknown to this build, identity, and repeats are
errors.
Sourcepub fn select(
sender_encode: &[StreamEncoding],
receiver_decode: &[StreamEncoding],
) -> StreamEncoding
pub fn select( sender_encode: &[StreamEncoding], receiver_decode: &[StreamEncoding], ) -> StreamEncoding
The encoding of one direction: the first entry of the sender’s
Encode list that the receiver’s Decode list contains, else
Identity, which both lists imply.
Trait Implementations§
Source§impl Clone for StreamEncoding
impl Clone for StreamEncoding
Source§fn clone(&self) -> StreamEncoding
fn clone(&self) -> StreamEncoding
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 StreamEncoding
Source§impl Debug for StreamEncoding
impl Debug for StreamEncoding
impl Eq for StreamEncoding
Source§impl Hash for StreamEncoding
impl Hash for StreamEncoding
Source§impl PartialEq for StreamEncoding
impl PartialEq for StreamEncoding
Source§fn eq(&self, other: &StreamEncoding) -> bool
fn eq(&self, other: &StreamEncoding) -> bool
self and other values to be equal, and is used by ==.