pub fn str_from_utf8(b: &[u8]) -> crate::Result<&str> {
    str::from_utf8(b).map_err(|err| {
        let bad = b[err.valid_up_to()..].to_vec();
        crate::Error {
            kind: crate::ErrorKind::StringDecoding(bad.to_vec()),
            description: "data is not valid utf-8".to_string(),
            partial_tag: None,
        }
    })
}
/// Helper for str::from_utf8 that preserves any problematic pattern if applicable.
Helper for str::from_utf8 that preserves any problematic pattern if applicable.
Helper for str :: from_utf8 that preserves any problematic pattern if applicable .
pub fn str_from_utf8(b: &[u8]) -> crate::Result<&str> {
    str::from_utf8(b).map_err(|err| {
        let bad = b[err.valid_up_to()..].to_vec();
        crate::Error {
            kind: crate::ErrorKind::StringDecoding(bad.to_vec()),
            description: "data is not valid utf-8".to_string(),
            partial_tag: None,
        }
    })
}
pub fn str_from_utf8 ( b : & [ u8 ] ) -> crate :: Result < & str > { str :: from_utf8 ( b ) . map_err ( | err | { let bad = b [ err . valid_up_to ( ) .. ] . to_vec ( ) ; crate :: Error { kind : crate :: ErrorKind :: StringDecoding ( bad . to_vec ( ) ) , description : " " . to_string ( ) , partial_tag : None , } } ) }
Helper for str::from_utf8 that preserves any problematic pattern if applicable.
Helper for str :: from_utf8 that preserves any problematic pattern if applicable .
b
&[u8]
b
&[u8]