#data #shared #safe #helper #marshalling #buffer #consumed

cobhan

Cobhan FFI is a system for enabling shared code to be written in Rust and consumed from all major languages/platforms in a safe and effective way, using easy helper functions to manage any unsafe data marshaling

2 releases

0.1.1 Nov 4, 2022
0.1.0 Mar 3, 2022

#3 in #consumed

Download history 1/week @ 2024-01-04 39/week @ 2024-01-11 60/week @ 2024-01-18 43/week @ 2024-01-25 79/week @ 2024-02-01 5/week @ 2024-02-08 6/week @ 2024-02-15 22/week @ 2024-02-22 3/week @ 2024-02-29 16/week @ 2024-03-07 11/week @ 2024-03-14 7/week @ 2024-03-21 17/week @ 2024-03-28 21/week @ 2024-04-04 60/week @ 2024-04-18

98 downloads per month

Custom license

17KB
216 lines

cobhan-rust - FFI Data Interface

Cobhan FFI is a system for enabling shared code to be written in Rust and consumed from all major languages/platforms in a safe and effective way, using easy helper functions to manage any unsafe data marshaling.

Types

  • Supported types
    • i32 - 32bit signed integer
    • i64 - 64bit signed integer
    • f64 - double precision 64bit IEEE 754 floating point
    • Cobhan buffer - length delimited 8bit buffer (no null delimiters)
      • utf-8 encoded string
      • JSON
      • binary data
  • Cobhan buffer details
    • Callers provide the output buffer allocation and capacity
    • Called functions can transparently return larger values via temporary files
    • Modern tmpfs is entirely memory backed
  • Return values
    • Functions that return scalar values can return the value directly
      • Functions can use special case and return maximum positive or maximum negative or zero values to represent error or overflow conditions
      • Functions can allow scalar values to wrap
      • Functions should document their overflow / underflow behavior

Dependencies

~2–11MB
~126K SLoC