From f0ab2b6aedb909d37698365d1fcc34ce749304b5 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Sat, 14 Jan 2017 09:39:05 -0800 Subject: [PATCH] feat(header): add Encoding::Brotli variant BREAKING CHANGE: This adds a new variant to the `Encoding` enum, which can break exhaustive matches. --- src/header/shared/encoding.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/header/shared/encoding.rs b/src/header/shared/encoding.rs index b8bf32f127..32087c0409 100644 --- a/src/header/shared/encoding.rs +++ b/src/header/shared/encoding.rs @@ -1,7 +1,7 @@ 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. @@ -9,6 +9,8 @@ pub use self::Encoding::{Chunked, Gzip, Deflate, Compress, Identity, EncodingExt pub enum Encoding { /// The `chunked` encoding. Chunked, + /// The `br` encoding. + Brotli, /// The `gzip` encoding. Gzip, /// The `deflate` encoding. @@ -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", @@ -39,6 +42,7 @@ impl str::FromStr for Encoding { fn from_str(s: &str) -> ::Result { match s { "chunked" => Ok(Chunked), + "br" => Ok(Brotli), "deflate" => Ok(Deflate), "gzip" => Ok(Gzip), "compress" => Ok(Compress),