@@ -30,7 +30,7 @@ impl<S: Scheme + Any> Header for Authorization<S> where <S as FromStr>::Err: 'st
30
30
31
31
fn parse_header ( raw : & [ Vec < u8 > ] ) -> Option < Authorization < S > > {
32
32
if raw. len ( ) == 1 {
33
- match ( from_utf8 ( unsafe { & raw . get_unchecked ( 0 ) [ ..] } ) , Scheme :: scheme ( None :: < S > ) ) {
33
+ match ( from_utf8 ( unsafe { & raw . get_unchecked ( 0 ) [ ..] } ) , < S as Scheme > :: scheme ( ) ) {
34
34
( Ok ( header) , Some ( scheme) )
35
35
if header. starts_with ( scheme) && header. len ( ) > scheme. len ( ) + 1 => {
36
36
header[ scheme. len ( ) + 1 ..] . parse :: < S > ( ) . map ( Authorization ) . ok ( )
@@ -46,7 +46,7 @@ impl<S: Scheme + Any> Header for Authorization<S> where <S as FromStr>::Err: 'st
46
46
47
47
impl < S : Scheme + Any > HeaderFormat for Authorization < S > where <S as FromStr >:: Err : ' static {
48
48
fn fmt_header ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
49
- match Scheme :: scheme ( None :: < S > ) {
49
+ match < S as Scheme > :: scheme ( ) {
50
50
Some ( scheme) => try!( write ! ( fmt, "{} " , scheme) ) ,
51
51
None => ( )
52
52
} ;
@@ -58,15 +58,14 @@ impl<S: Scheme + Any> HeaderFormat for Authorization<S> where <S as FromStr>::Er
58
58
pub trait Scheme : FromStr + fmt:: Debug + Clone + Send + Sync {
59
59
/// An optional Scheme name.
60
60
///
61
- /// For example, `Basic asdf` has the name `Basic`. The Option<Self> is
62
- /// just a marker that can be removed once UFCS is completed.
63
- fn scheme ( Option < Self > ) -> Option < & ' static str > ;
61
+ /// Will be replaced with an associated constant once available.
62
+ fn scheme ( ) -> Option < & ' static str > ;
64
63
/// Format the Scheme data into a header value.
65
64
fn fmt_scheme ( & self , & mut fmt:: Formatter ) -> fmt:: Result ;
66
65
}
67
66
68
67
impl Scheme for String {
69
- fn scheme ( _ : Option < String > ) -> Option < & ' static str > {
68
+ fn scheme ( ) -> Option < & ' static str > {
70
69
None
71
70
}
72
71
@@ -86,7 +85,7 @@ pub struct Basic {
86
85
}
87
86
88
87
impl Scheme for Basic {
89
- fn scheme ( _ : Option < Basic > ) -> Option < & ' static str > {
88
+ fn scheme ( ) -> Option < & ' static str > {
90
89
Some ( "Basic" )
91
90
}
92
91
0 commit comments