ffi-result 0.1.0

FFI-compatibe and ABI-stable analogue for core::result::Result.
Documentation
  • Coverage
  • 10.71%
    3 out of 28 items documented0 out of 23 items with examples
  • Size
  • Source code size: 10.05 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.28 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • USSURATONCACHI/ffi-result
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • USSURATONCACHI

ffi-result

FFI-compatibe and ABI-stable analogue for core::result::Result<T, E>.

Example

This result is used the same way as the regular Result<T, E>. It can be freely converted to and from a regular Result<T, E>. It is meant to use in ffi functions.

#[unsafe(no_mangle)]
pub unsafe extern "C" fn example_function(data: std::ffi::CString) -> ffi_result::Result<i32, std::ffi::CString> {
    if todo!() {
        Ok(123).into()
    } else {
        Err(data).into()
    }
}