pub fn into_string(self) -> Result<String, IntoStringError> {
        let chunks = self.chunks();

        match chunks.next_surrogate() {
            Some(position) => Err(IntoStringError {
                wtf8: self,
                valid_up_to: position,
            }),
            // Safety: No surrogates, so UTF-8 is guaranteed.
            None => unsafe { Ok(String::from_utf8_unchecked(self.bytes)) },
        }
    }
/// Consumes the WTF-8 string and tries to convert it to UTF-8.
///
/// This does not copy the data.
///
/// If the contents are not well-formed UTF-8
/// (that is, if the string contains surrogates),
/// the original WTF-8 string is returned instead.

Consumes the WTF-8 string and tries to convert it to UTF-8.
This does not copy the data.

If the contents are not well-formed UTF-8
(that is, if the string contains surrogates),
the original WTF-8 string is returned instead.
Consumes the WTF - 8 string and tries to convert it to UTF - 8 . This does not copy the data . If the contents are not well - formed UTF - 8 ( that is if the string contains surrogates ) the original WTF - 8 string is returned instead .
pub fn into_string(self) -> Result<String, IntoStringError> {
        let chunks = self.chunks();
        match chunks.next_surrogate() {
            Some(position) => Err(IntoStringError {
                wtf8: self,
                valid_up_to: position,
            }),
            // Safety: No surrogates, so UTF-8 is guaranteed.
            None => unsafe { Ok(String::from_utf8_unchecked(self.bytes)) },
        }
    }
pub fn into_string ( self ) -> Result < String , IntoStringError > { let chunks = self . chunks ( ) ; match chunks . next_surrogate ( ) { Some ( position ) => Err ( IntoStringError { wtf8 : self , valid_up_to : position , } ) , // Safety: No surrogates, so UTF-8 is guaranteed.
 None => unsafe { Ok ( String :: from_utf8_unchecked ( self . bytes ) ) } , } }
Consumes the WTF-8 string and tries to convert it to UTF-8.
Consumes the WTF - 8 string and tries to convert it to UTF - 8 .
self
self