Skip to content

Commit

Permalink
feat(header): add Encoding::Brotli variant
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This adds a new variant to the `Encoding` enum, which
  can break exhaustive matches.
  • Loading branch information
seanmonstar committed Jan 16, 2017
1 parent cd9fd52 commit f0ab2b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/header/shared/encoding.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
use std::fmt;
use std::str;

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

/// A value to represent an encoding used in `Transfer-Encoding`
/// or `Accept-Encoding` header.
#[derive(Clone, PartialEq, Debug)]
pub enum Encoding {
/// The `chunked` encoding.
Chunked,
/// The `br` encoding.
Brotli,
/// The `gzip` encoding.
Gzip,
/// The `deflate` encoding.
Expand All @@ -25,6 +27,7 @@ impl fmt::Display for Encoding {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(match *self {
Chunked => "chunked",
Brotli => "br",
Gzip => "gzip",
Deflate => "deflate",
Compress => "compress",
Expand All @@ -39,6 +42,7 @@ impl str::FromStr for Encoding {
fn from_str(s: &str) -> ::Result<Encoding> {
match s {
"chunked" => Ok(Chunked),
"br" => Ok(Brotli),
"deflate" => Ok(Deflate),
"gzip" => Ok(Gzip),
"compress" => Ok(Compress),
Expand Down

0 comments on commit f0ab2b6

Please sign in to comment.