fn with_temporary_c_str<B, F>(s: &str, f: F) -> B
    where F: FnOnce(*mut c_char) -> B
{
    // It is not safe to use CString here; LAMMPS may write NUL bytes
    // that change the length of the string.
    let mut bytes = s.to_string().into_bytes();
    bytes.push(0);
    f(bytes.as_mut_ptr() as *mut c_char)
}
// Temporarily allocate a C string for the duration of a closure.
//
// The closure may make arbitrary modifications to the string's
// content (including writes of interior NUL bytes), but must not
// write beyond the `s.len() + 1` allocated bytes for the C string.
Temporarily allocate a C string for the duration of a closure.
The closure may make arbitrary modifications to the string's
content (including writes of interior NUL bytes), but must not
write beyond the `s.len() + 1` allocated bytes for the C string.
Temporarily allocate a C string for the duration of a closure . The closure may make arbitrary modifications to the string ' s content ( including writes of interior NUL bytes ) but must not write beyond the ` s . len () + 1 ` allocated bytes for the C string .
fn with_temporary_c_str<B, F>(s: &str, f: F) -> B
    where F: FnOnce(*mut c_char) -> B
{
    // It is not safe to use CString here; LAMMPS may write NUL bytes
    // that change the length of the string.
    let mut bytes = s.to_string().into_bytes();
    bytes.push(0);
    f(bytes.as_mut_ptr() as *mut c_char)
}
fn with_temporary_c_str < B , F > ( s : & str , f : F ) -> B where F : FnOnce ( * mut c_char ) -> B { // It is not safe to use CString here; LAMMPS may write NUL bytes // that change the length of the string. let mut bytes = s . to_string ( ) . into_bytes ( ) ; bytes . push ( 0 ) ; f ( bytes . as_mut_ptr ( ) as * mut c_char ) }
Temporarily allocate a C string for the duration of a closure.
Temporarily allocate a C string for the duration of a closure .
s
&str
f
F
s
&str
f
F