fn c_and_back_again(arg: &str) -> String {
        CString::new(arg)
            .map(|s| s.to_str().expect("Invalid UTF-8").to_string())
            .unwrap_or_else(|_| "(null)".to_string()) //when we pass a NULL to sprintf with %s fmt it outputs"(null)"
    }
/// Convert a Rust string to a CString and then back again.  Some of the Quickcheck strings
/// contains NULLs and thus fail this test and convert back as empty strings.  In that case
/// we should expect an "(null)" string result not the original string, which is what this method
/// provides.
Convert a Rust string to a CString and then back again.  Some of the Quickcheck strings
contains NULLs and thus fail this test and convert back as empty strings.  In that case
we should expect an "(null)" string result not the original string, which is what this method
provides.
Convert a Rust string to a CString and then back again . Some of the Quickcheck strings contains NULLs and thus fail this test and convert back as empty strings . In that case we should expect an " ( null ) " string result not the original string which is what this method provides .
fn c_and_back_again(arg: &str) -> String {
        CString::new(arg)
            .map(|s| s.to_str().expect("Invalid UTF-8").to_string())
            .unwrap_or_else(|_| "(null)".to_string()) //when we pass a NULL to sprintf with %s fmt it outputs"(null)"
    }
fn c_and_back_again ( arg : & str ) -> String { CString :: new ( arg ) . map ( | s | s . to_str ( ) . expect ( " " ) . to_string ( ) ) . unwrap_or_else ( | _ | " " . to_string ( ) ) //when we pass a NULL to sprintf with %s fmt it outputs"(null)" }
Convert a Rust string to a CString and then back again.
Convert a Rust string to a CString and then back again .
arg
&str
arg
&str