Binding
binding
is a foundational Rust crate providing safe and ergonomic
abstractions for Foreign Function Interface (FFI) bindings. It serves as the
core layer for building robust, cross-platform Rust bindings to native C APIs,
enabling seamless integration between Rust and C codebases.
Features
- Safe abstractions over unsafe FFI calls
- Ergonomic trait-driven interfaces for common binding patterns
- Cross-platform support for Windows and Linux
- Designed with zero-cost abstractions in mind, maintaining performance
- Facilitates building high-quality Rust wrappers around C libraries
Add to Your Project
This library is hosted on the CyberMages registry. To add it to your project, the CyberMages registry must be added to your Cargo configuration as described in the Cargo Book.
First, add the registry to your Cargo config (.cargo/config.toml
or
$CARGO_HOME/config.toml
):
[registries.cybermages]
index = "sparse+https://workshop.cybermages.tech/api/packages/CyberMages/cargo/"
Then add binding
as a dependency in your Cargo.toml
:
[dependencies]
binding = { version = "0.x", registry = "cybermages" }
Getting Started
Motivation
Working with native C libraries from Rust often requires careful handling of
unsafe code and complex boilerplate. The binding
crate aims to reduce this
friction by providing reusable, well-tested abstractions that improve safety,
readability, and maintainability of Rust FFI code.
Copyright & License
Copyright 2017 CyberMages LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this library except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS