@@ -108,17 +108,17 @@ impl MessageParser {
108
108
/// This function never panics, a best-effort is made to parse the message and
109
109
/// if no headers are found None is returned.
110
110
///
111
- pub fn parse < ' x > ( & self , raw_message : impl IntoByteSlice < ' x > ) -> Option < Message < ' x > > {
112
- self . parse_ ( raw_message. into_byte_slice ( ) , MAX_NESTED_ENCODED , false )
111
+ pub fn parse < ' x > ( & self , raw_message : & ' x ( impl AsRef < [ u8 ] > + ? Sized ) ) -> Option < Message < ' x > > {
112
+ self . parse_ ( raw_message. as_ref ( ) , MAX_NESTED_ENCODED , false )
113
113
}
114
114
115
115
/// Parses a byte slice containing the RFC5322 raw message and returns a
116
116
/// `Message` struct containing only the headers.
117
117
pub fn parse_headers < ' x > (
118
118
& self ,
119
- raw_message : impl IntoByteSlice < ' x > + ' x ,
119
+ raw_message : & ' x ( impl AsRef < [ u8 ] > + ? Sized ) ,
120
120
) -> Option < Message < ' x > > {
121
- self . parse_ ( raw_message. into_byte_slice ( ) , MAX_NESTED_ENCODED , true )
121
+ self . parse_ ( raw_message. as_ref ( ) , MAX_NESTED_ENCODED , true )
122
122
}
123
123
124
124
fn parse_ < ' x > (
@@ -549,40 +549,6 @@ impl<'x> Message<'x> {
549
549
}
550
550
}
551
551
552
- pub trait IntoByteSlice < ' x > {
553
- fn into_byte_slice ( self ) -> & ' x [ u8 ] ;
554
- }
555
-
556
- impl < ' x > IntoByteSlice < ' x > for & ' x [ u8 ] {
557
- fn into_byte_slice ( self ) -> & ' x [ u8 ] {
558
- self
559
- }
560
- }
561
-
562
- impl < ' x , const N : usize > IntoByteSlice < ' x > for & ' x [ u8 ; N ] {
563
- fn into_byte_slice ( self ) -> & ' x [ u8 ] {
564
- self
565
- }
566
- }
567
-
568
- impl < ' x > IntoByteSlice < ' x > for & ' x str {
569
- fn into_byte_slice ( self ) -> & ' x [ u8 ] {
570
- self . as_bytes ( )
571
- }
572
- }
573
-
574
- impl < ' x > IntoByteSlice < ' x > for & ' x String {
575
- fn into_byte_slice ( self ) -> & ' x [ u8 ] {
576
- self . as_bytes ( )
577
- }
578
- }
579
-
580
- impl < ' x > IntoByteSlice < ' x > for & ' x Vec < u8 > {
581
- fn into_byte_slice ( self ) -> & ' x [ u8 ] {
582
- self
583
- }
584
- }
585
-
586
552
#[ cfg( test) ]
587
553
mod tests {
588
554
use std:: { fs, path:: PathBuf } ;
0 commit comments