ffi-result

Crates.ioffi-result
lib.rsffi-result
version0.1.0
created_at2025-05-17 19:31:08.416986+00
updated_at2025-05-17 19:31:08.416986+00
descriptionFFI-compatibe and ABI-stable analogue for core::result::Result.
homepage
repositoryhttps://github.com/USSURATONCACHI/ffi-result
max_upload_size
id1678100
size10,537
Redchin Daniil (USSURATONCACHI)

documentation

README

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()
    }
}
Commit count: 2

cargo fmt