| Crates.io | ephapax-proven-sys |
| lib.rs | ephapax-proven-sys |
| version | 0.1.0 |
| created_at | 2026-01-24 08:10:08.719535+00 |
| updated_at | 2026-01-24 08:10:08.719535+00 |
| description | Raw FFI bindings to pure Zig implementation of Proven library (formally verified) |
| homepage | |
| repository | https://github.com/hyperpolymath/ephapax-proven-sys |
| max_upload_size | |
| id | 2066384 |
| size | 122,385 |
= ephapax-proven-sys :toc: :toc-placement!:
Raw Rust FFI bindings to ephapax-proven-ffi
Unsafe Rust bindings to the Zig-based FFI library bridging Ephapax (linear types) with Proven (dependent types).
toc::[]
== Overview
This is a -sys crate providing raw, unsafe FFI bindings to libephapax_proven.so. For safe, idiomatic Rust wrappers, see the ephapax-proven crate.
=== Features
=== Supported Modules
[cols="1,2"] |=== |Module |Functions
|LRU Cache |7 functions: new, put, get, contains, size, is_full, free
|Buffer |8 functions: new, write, read, capacity, size, is_full, remaining, free
|Resource Handle |6 functions: new_handle, mark_acquired, mark_released, is_held, get_state, free_handle |===
== Installation
Add to your Cargo.toml:
=== Requirements
libephapax_proven.so from https://github.com/hyperpolymath/ephapax-proven-ffi[ephapax-proven-ffi]=== Linking
By default, the build script looks for the library in ../ephapax-proven-ffi. Override with:
== Usage
All functions are unsafe. You must ensure:
!Send and !Sync)=== Example: LRU Cache
use ephapax_proven_sys::*;
unsafe { let cache = idris_proven_lru_new(100); assert!(!cache.is_null());
let key = b"test_key";
let val = b"test_value";
let cache = idris_proven_lru_put(
cache,
key.as_ptr(), key.len() as u64,
val.as_ptr(), val.len() as u64
);
assert_eq!(idris_proven_lru_size(cache), 1);
idris_proven_lru_free(cache);
=== Example: Buffer
use ephapax_proven_sys::*;
unsafe { let buf = idris_proven_buffer_new(1024); assert!(!buf.is_null());
let data = b"Hello, formal verification!";
let result = idris_proven_buffer_write(
buf,
data.as_ptr(),
data.len() as u64
);
assert_eq!(result, 0); // 0 = success
assert_eq!(idris_proven_buffer_size(buf), data.len() as u64);
idris_proven_buffer_free(buf);
=== Example: Resource Handle
use ephapax_proven_sys::*; use std::time::{SystemTime, UNIX_EPOCH};
unsafe { let handle = idris_proven_resource_new_handle(42); assert!(!handle.is_null());
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs();
let handle = idris_proven_resource_mark_acquired(handle, timestamp);
assert!(idris_proven_resource_is_held(handle));
let state = idris_proven_resource_get_state(handle);
assert_eq!(state, ResourceState::Acquired as u32);
idris_proven_resource_free_handle(handle);
== Safety
This crate is unsafe by design. Every function has detailed safety documentation. Common pitfalls:
*_free twice on the same pointer*_freeSend/Sync)For safe wrappers with RAII and linear types, use ephapax-proven.
== API Reference
See https://docs.rs/ephapax-proven-sys[docs.rs] for full API documentation.
== Testing
Run tests with the library in the default location:
Or specify a custom location:
== Related Crates
== License
SPDX-License-Identifier: Palimpsest-1.0-or-later
Built on Mozilla Public License 2.0-or-later (MPL-2.0-or-later).
See https://github.com/hyperpolymath/palimpsest-license[Palimpsest License] for full text.
== Contributing
See link:CONTRIBUTING.adoc[] for guidelines.
This crate follows Hyperpolymath standards: