For primitive types, there is a direct way to pass them to C, (for pointers to primitive types And, to be clear, I know that libc crate implements fopen, which in turn gives me a mut FILE* (which will eventually do the job). However, I want to know if there is something in the Rust standard library that gives I pass a FILE* to librsync-maybe something similar to std::ffi::CString.
I used to play with writing library bindings in Rust and it was not difficult. However, now, I am stuck: I am trying to write a binding for librsync, and some of its functions expect you to pass an open file handle ( FILE *) in C.
For primitive types, there is a direct way to pass them to C, (the same is true for pointers to primitive types). And, to be clear, I know libc crate implements fopen, which in turn gives me a mut FILE* (which will eventually do the job). However, I want to know if there is something in the Rust standard library to give me a FILE* to pass to librsync-maybe something like std::ffi::CString stuff.
Of course you can use RawFd, transmute and use it to call libc::funcs::posix88::stdio: fdopen(_,mode). But it will be very non-portable.