1
1
use std:: io:: { MemReader , MemWriter } ;
2
2
use std:: str;
3
+ use std:: fmt;
3
4
use headers:: { HeaderConvertible , HeaderValueByteIterator } ;
4
5
5
6
pub fn from_stream_with_str < T : HeaderConvertible > ( s : & str ) -> Option < T > {
@@ -18,14 +19,14 @@ pub fn to_stream_into_str<T: HeaderConvertible>(v: &T) -> ~str {
18
19
19
20
// Verify that a value cannot be successfully interpreted as a header value of the specified type.
20
21
#[ inline]
21
- pub fn assert_invalid < T : HeaderConvertible > ( string : & str ) {
22
+ pub fn assert_invalid < T : HeaderConvertible + fmt :: Show > ( string : & str ) {
22
23
assert_eq ! ( from_stream_with_str:: <T >( string) , None ) ;
23
24
}
24
25
25
26
// Verify that all of the methods from the HeaderConvertible trait work correctly for the given
26
27
// valid header value and correct decoded value.
27
28
#[ inline]
28
- pub fn assert_conversion_correct < T : HeaderConvertible > ( string : & ' static str , value : T ) {
29
+ pub fn assert_conversion_correct < T : HeaderConvertible + fmt :: Show > ( string : & ' static str , value : T ) {
29
30
assert_eq ! ( from_stream_with_str( string) , Some ( value. clone( ) ) ) ;
30
31
let s = to_stream_into_str ( & value) ;
31
32
assert_eq ! ( s. as_slice( ) , string) ;
@@ -35,6 +36,6 @@ pub fn assert_conversion_correct<T: HeaderConvertible>(string: &'static str, val
35
36
36
37
// Verify that from_stream interprets the given valid header value correctly.
37
38
#[ inline]
38
- pub fn assert_interpretation_correct < T : HeaderConvertible > ( string : & ' static str , value : T ) {
39
+ pub fn assert_interpretation_correct < T : HeaderConvertible + fmt :: Show > ( string : & ' static str , value : T ) {
39
40
assert_eq ! ( from_stream_with_str( string) , Some ( value) ) ;
40
41
}
0 commit comments