66
77use crate :: num:: NonZeroChar ;
88use std:: ffi:: CStr ;
9- use std:: num:: NonZero ;
9+ use std:: num:: NonZeroU8 ;
1010use std:: ops:: Range ;
1111use std:: str:: Chars ;
1212
@@ -261,7 +261,7 @@ pub enum MixedUnit {
261261 /// For example, if `\xa5` appears in a string it is represented here as
262262 /// `MixedUnit::HighByte(0xa5)`, and it will be appended to the relevant
263263 /// byte string as the single byte `0xa5`.
264- HighByte ( NonZero < u8 > ) ,
264+ HighByte ( NonZeroU8 ) ,
265265}
266266
267267impl From < NonZeroChar > for MixedUnit {
@@ -271,9 +271,9 @@ impl From<NonZeroChar> for MixedUnit {
271271 }
272272}
273273
274- impl From < NonZero < u8 > > for MixedUnit {
274+ impl From < NonZeroU8 > for MixedUnit {
275275 #[ inline]
276- fn from ( byte : NonZero < u8 > ) -> Self {
276+ fn from ( byte : NonZeroU8 ) -> Self {
277277 if byte. get ( ) . is_ascii ( ) {
278278 MixedUnit :: Char ( NonZeroChar :: new ( byte. get ( ) as char ) . unwrap ( ) )
279279 } else {
@@ -298,7 +298,7 @@ impl TryFrom<u8> for MixedUnit {
298298
299299 #[ inline]
300300 fn try_from ( byte : u8 ) -> Result < Self , EscapeError > {
301- NonZero :: new ( byte)
301+ NonZeroU8 :: new ( byte)
302302 . map ( From :: from)
303303 . ok_or ( EscapeError :: NulInCStr )
304304 }
@@ -313,7 +313,7 @@ trait Unescape {
313313 const ZERO_RESULT : Result < Self :: Unit , EscapeError > ;
314314
315315 /// Converts non-zero bytes to the unit type
316- fn nonzero_byte2unit ( b : NonZero < u8 > ) -> Self :: Unit ;
316+ fn nonzero_byte2unit ( b : NonZeroU8 ) -> Self :: Unit ;
317317
318318 /// Converts chars to the unit type
319319 fn char2unit ( c : char ) -> Result < Self :: Unit , EscapeError > ;
@@ -401,9 +401,9 @@ trait Unescape {
401401///
402402/// Parses the character of an ASCII escape (except nul) without the leading backslash.
403403#[ inline] // single use in Unescape::unescape_1
404- fn simple_escape ( c : char ) -> Result < NonZero < u8 > , char > {
404+ fn simple_escape ( c : char ) -> Result < NonZeroU8 , char > {
405405 // Previous character was '\\', unescape what follows.
406- Ok ( NonZero :: new ( match c {
406+ Ok ( NonZeroU8 :: new ( match c {
407407 '"' => b'"' ,
408408 'n' => b'\n' ,
409409 'r' => b'\r' ,
@@ -519,7 +519,7 @@ impl Unescape for str {
519519 const ZERO_RESULT : Result < Self :: Unit , EscapeError > = Ok ( '\0' ) ;
520520
521521 #[ inline]
522- fn nonzero_byte2unit ( b : NonZero < u8 > ) -> Self :: Unit {
522+ fn nonzero_byte2unit ( b : NonZeroU8 ) -> Self :: Unit {
523523 b. get ( ) . into ( )
524524 }
525525
@@ -549,7 +549,7 @@ impl Unescape for [u8] {
549549 const ZERO_RESULT : Result < Self :: Unit , EscapeError > = Ok ( b'\0' ) ;
550550
551551 #[ inline]
552- fn nonzero_byte2unit ( b : NonZero < u8 > ) -> Self :: Unit {
552+ fn nonzero_byte2unit ( b : NonZeroU8 ) -> Self :: Unit {
553553 b. get ( )
554554 }
555555
@@ -575,7 +575,7 @@ impl Unescape for CStr {
575575 const ZERO_RESULT : Result < Self :: Unit , EscapeError > = Err ( EscapeError :: NulInCStr ) ;
576576
577577 #[ inline]
578- fn nonzero_byte2unit ( b : NonZero < u8 > ) -> Self :: Unit {
578+ fn nonzero_byte2unit ( b : NonZeroU8 ) -> Self :: Unit {
579579 b. into ( )
580580 }
581581
0 commit comments