fn bad_string(text: &str) -> OsString {
        #[cfg(any(unix, target_os = "wasi"))]
        {
            let mut text = text.as_bytes().to_vec();
            for ch in &mut text {
                if *ch == b'@' {
                    *ch = b'\xFF';
                }
            }
            OsString::from_vec(text)
        }
        #[cfg(windows)]
        {
            let mut out = Vec::new();
            for ch in text.chars() {
                if ch == '@' {
                    out.push(0xD800);
                } else {
                    let mut buf = [0; 2];
                    out.extend(&*ch.encode_utf16(&mut buf));
                }
            }
            OsString::from_wide(&out)
        }
        #[cfg(not(any(unix, target_os = "wasi", windows)))]
        {
            if text.contains('@') {
                unimplemented!("Don't know how to create invalid OsStrings on this platform");
            }
            text.into()
        }
    }
/// Transform @ characters into invalid unicode.
Transform @ characters into invalid unicode.
Transform @ characters into invalid unicode .
fn bad_string(text: &str) -> OsString {
        #[cfg(any(unix, target_os = "wasi"))]
        {
            let mut text = text.as_bytes().to_vec();
            for ch in &mut text {
                if *ch == b'@' {
                    *ch = b'\xFF';
                }
            }
            OsString::from_vec(text)
        }
        #[cfg(windows)]
        {
            let mut out = Vec::new();
            for ch in text.chars() {
                if ch == '@' {
                    out.push(0xD800);
                } else {
                    let mut buf = [0; 2];
                    out.extend(&*ch.encode_utf16(&mut buf));
                }
            }
            OsString::from_wide(&out)
        }
        #[cfg(not(any(unix, target_os = "wasi", windows)))]
        {
            if text.contains('@') {
                unimplemented!("Don't know how to create invalid OsStrings on this platform");
            }
            text.into()
        }
    }
fn bad_string ( text : & str ) -> OsString { # [ cfg ( any ( unix target_os " " ) ) ] { let mut text = text . as_bytes ( ) . to_vec ( ) ; for ch in & mut text { if * ch == b'@' { * ch = b'\xFF' ; } } OsString :: from_vec ( text ) } # [ cfg ( windows ) ] { let mut out = Vec :: new ( ) ; for ch in text . chars ( ) { if ch == '@' { out . push ( 0xD800 ) ; } else { let mut buf = [ 0 ; 2 ] ; out . extend ( & * ch . encode_utf16 ( & mut buf ) ) ; } } OsString :: from_wide ( & out ) } # [ cfg ( not ( any ( unix target_os " " windows ) ) ) ] { if text . contains ( '@' ) { unimplemented ! ( " " ) ; } text . into ( ) } }
Transform @ characters into invalid unicode.
Transform @ characters into invalid unicode .
text
&str