4 releases
Uses new Rust 2024
| 0.1.3 | Feb 23, 2026 |
|---|---|
| 0.1.2 | Jan 13, 2026 |
| 0.1.1 | Jan 5, 2026 |
| 0.1.0 | Jan 5, 2026 |
#141 in #pyo3
Used in bridgerust
28KB
597 lines
BridgeRust Macros
Procedural macros for the BridgeRust framework.
Website: bridgerust.dev
Overview
This crate provides the core macros used to expose Rust code to Python and Node.js. It is re-exported by the main bridgerust crate and should generally not be used directly.
Macros
#[export]
Marks a function, struct, or impl block for export to Python and Node.js.
use bridgerust::export;
#[export]
pub fn greet(name: String) -> String {
format!("Hello, {}!", name)
}
#[constructor]
Marks a method within an impl block as the constructor (__init__ in Python, constructor in JS).
use bridgerust::export;
#[export]
pub struct Client {
url: String,
}
#[export]
impl Client {
#[constructor]
pub fn new(url: String) -> Self {
Self { url }
}
}
#[error]
Registers a custom error type for cross-language error handling.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~105–465KB
~11K SLoC