@@ -475,12 +475,12 @@ impl OwnedAsciiExt for AsciiString {
475
475
}
476
476
477
477
/// Trait for converting into an ascii type.
478
- pub trait AsciiCast : AsciiExt {
478
+ pub trait AsciiCast < ' a > : AsciiExt {
479
479
type Target ;
480
480
481
481
/// Convert to an ascii type, return Err(()) on non-ASCII input.
482
482
#[ inline]
483
- fn to_ascii ( & self ) -> Result < Self :: Target , ( ) > {
483
+ fn to_ascii ( & ' a self ) -> Result < Self :: Target , ( ) > {
484
484
if self . is_ascii ( ) {
485
485
Ok ( unsafe { self . to_ascii_nocheck ( ) } )
486
486
} else {
@@ -489,28 +489,28 @@ pub trait AsciiCast : AsciiExt {
489
489
}
490
490
491
491
/// Convert to an ascii type, not doing any range asserts
492
- unsafe fn to_ascii_nocheck ( & self ) -> Self :: Target ;
492
+ unsafe fn to_ascii_nocheck ( & ' a self ) -> Self :: Target ;
493
493
}
494
494
495
- impl < ' a > AsciiCast for [ u8 ] {
495
+ impl < ' a > AsciiCast < ' a > for [ u8 ] {
496
496
type Target = & ' a AsciiStr ;
497
497
498
498
#[ inline]
499
- unsafe fn to_ascii_nocheck ( & self ) -> & ' a AsciiStr {
499
+ unsafe fn to_ascii_nocheck ( & ' a self ) -> & ' a AsciiStr {
500
500
mem:: transmute ( self )
501
501
}
502
502
}
503
503
504
- impl < ' a > AsciiCast for str {
504
+ impl < ' a > AsciiCast < ' a > for str {
505
505
type Target = & ' a AsciiStr ;
506
506
507
507
#[ inline]
508
- unsafe fn to_ascii_nocheck ( & self ) -> & ' a AsciiStr {
508
+ unsafe fn to_ascii_nocheck ( & ' a self ) -> & ' a AsciiStr {
509
509
mem:: transmute ( self )
510
510
}
511
511
}
512
512
513
- impl AsciiCast for u8 {
513
+ impl < ' a > AsciiCast < ' a > for u8 {
514
514
type Target = Ascii ;
515
515
516
516
#[ inline]
@@ -519,7 +519,7 @@ impl AsciiCast for u8 {
519
519
}
520
520
}
521
521
522
- impl AsciiCast for char {
522
+ impl < ' a > AsciiCast < ' a > for char {
523
523
type Target = Ascii ;
524
524
525
525
#[ inline]
0 commit comments