Where does one even start ?
In any rust project, you start with API docs, and the examples folder if one exists. Just make sure the examples belong to the current version you will depend on, not the master/main branch. The link above is from v0.13.1 for example.
Doubly linked list is one of std’s collections. And safety in Rust is built on top of unsafely, because there is no way around that.
Did you try to actually look up literally anything before asking?! Because simply checking out std::collections
docs would have given you some answers.
Is everyone genuinely liking this!
This is, IMHO, not a good style.
Isn’t something like this much clearer?
// Add `as_cstr()` to `NixPath` trait first
let some_or_null_cstr = |v| v.map(NixPath::as_cstr)
.unwrap_or(Ok(std::ptr::null()));
// `Option::or_null_cstr()` for `OptionᐸTᐳ`
// where `T: NixPath` would make this even better
let source_cstr = some_or_null_cstr(&source)?;
let target_cstr = target.as_cstr()?;
let fs_type_cstr = some_or_null_cstr(&fs_type)?;
let data_cstr = some_or_null_cstr(&data)?;
let res = unsafe { .. };
Edit: using alternative chars to circumvent broken Lemmy sanitization.
Great to see this progressing still.
Great to see you posting here as well.
All the best.