44//! Utilities for validating (raw) string, char, and byte literals and 
55//! turning escape sequences into the values they represent. 
66
7+ use  crate :: num:: NonZeroChar ; 
78use  std:: ffi:: CStr ; 
89use  std:: num:: NonZero ; 
910use  std:: ops:: Range ; 
@@ -108,7 +109,7 @@ pub fn check_raw_byte_str(src: &str, callback: impl FnMut(Range<usize>, Result<u
108109/// NOTE: Does no escaping, but produces errors for bare carriage return ('\r'). 
109110pub  fn  check_raw_c_str ( 
110111    src :  & str , 
111-     callback :  impl  FnMut ( Range < usize > ,  Result < NonZero < char > ,  EscapeError > ) , 
112+     callback :  impl  FnMut ( Range < usize > ,  Result < NonZeroChar ,  EscapeError > ) , 
112113)  { 
113114    CStr :: check_raw ( src,  callback) ; 
114115} 
@@ -185,11 +186,11 @@ fn char2byte(c: char) -> Result<u8, EscapeError> {
185186} 
186187
187188impl  CheckRaw  for  CStr  { 
188-     type  RawUnit  = NonZero < char > ; 
189+     type  RawUnit  = NonZeroChar ; 
189190
190191    #[ inline]  
191192    fn  char2raw_unit ( c :  char )  -> Result < Self :: RawUnit ,  EscapeError >  { 
192-         NonZero :: new ( c) . ok_or ( EscapeError :: NulInCStr ) 
193+         NonZeroChar :: new ( c) . ok_or ( EscapeError :: NulInCStr ) 
193194    } 
194195} 
195196
@@ -253,7 +254,7 @@ pub enum MixedUnit {
253254/// For example, if '¥' appears in a string it is represented here as 
254255/// `MixedUnit::Char('¥')`, and it will be appended to the relevant byte 
255256/// string as the two-byte UTF-8 sequence `[0xc2, 0xa5]` 
256- Char ( NonZero < char > ) , 
257+ Char ( NonZeroChar ) , 
257258
258259    /// Used for high bytes (`\x80`..`\xff`). 
259260/// 
@@ -263,9 +264,9 @@ pub enum MixedUnit {
263264HighByte ( NonZero < u8 > ) , 
264265} 
265266
266- impl  From < NonZero < char > >  for  MixedUnit  { 
267+ impl  From < NonZeroChar >  for  MixedUnit  { 
267268    #[ inline]  
268-     fn  from ( c :  NonZero < char > )  -> Self  { 
269+     fn  from ( c :  NonZeroChar )  -> Self  { 
269270        MixedUnit :: Char ( c) 
270271    } 
271272} 
@@ -274,7 +275,7 @@ impl From<NonZero<u8>> for MixedUnit {
274275    #[ inline]  
275276    fn  from ( byte :  NonZero < u8 > )  -> Self  { 
276277        if  byte. get ( ) . is_ascii ( )  { 
277-             MixedUnit :: Char ( NonZero :: new ( byte. get ( )  as  char ) . unwrap ( ) ) 
278+             MixedUnit :: Char ( NonZeroChar :: new ( byte. get ( )  as  char ) . unwrap ( ) ) 
278279        }  else  { 
279280            MixedUnit :: HighByte ( byte) 
280281        } 
@@ -286,7 +287,7 @@ impl TryFrom<char> for MixedUnit {
286287
287288    #[ inline]  
288289    fn  try_from ( c :  char )  -> Result < Self ,  EscapeError >  { 
289-         NonZero :: new ( c) 
290+         NonZeroChar :: new ( c) 
290291            . map ( MixedUnit :: Char ) 
291292            . ok_or ( EscapeError :: NulInCStr ) 
292293    } 
0 commit comments