Skip to content

Commit f0ab2b6

Browse files
committed
feat(header): add Encoding::Brotli variant
BREAKING CHANGE: This adds a new variant to the `Encoding` enum, which can break exhaustive matches.
1 parent cd9fd52 commit f0ab2b6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/header/shared/encoding.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
use std::fmt;
22
use std::str;
33

4-
pub use self::Encoding::{Chunked, Gzip, Deflate, Compress, Identity, EncodingExt};
4+
pub use self::Encoding::{Chunked, Brotli, Gzip, Deflate, Compress, Identity, EncodingExt};
55

66
/// A value to represent an encoding used in `Transfer-Encoding`
77
/// or `Accept-Encoding` header.
88
#[derive(Clone, PartialEq, Debug)]
99
pub enum Encoding {
1010
/// The `chunked` encoding.
1111
Chunked,
12+
/// The `br` encoding.
13+
Brotli,
1214
/// The `gzip` encoding.
1315
Gzip,
1416
/// The `deflate` encoding.
@@ -25,6 +27,7 @@ impl fmt::Display for Encoding {
2527
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2628
f.write_str(match *self {
2729
Chunked => "chunked",
30+
Brotli => "br",
2831
Gzip => "gzip",
2932
Deflate => "deflate",
3033
Compress => "compress",
@@ -39,6 +42,7 @@ impl str::FromStr for Encoding {
3942
fn from_str(s: &str) -> ::Result<Encoding> {
4043
match s {
4144
"chunked" => Ok(Chunked),
45+
"br" => Ok(Brotli),
4246
"deflate" => Ok(Deflate),
4347
"gzip" => Ok(Gzip),
4448
"compress" => Ok(Compress),

0 commit comments

Comments
 (0)