bridgerust-macros

Crates.iobridgerust-macros
lib.rsbridgerust-macros
version0.1.2
created_at2026-01-05 08:08:06.689088+00
updated_at2026-01-13 14:54:51.671453+00
descriptionProcedural macros for BridgeRust framework
homepagehttps://bridgerust.dev
repositoryhttps://github.com/bridgerust/bridgerust
max_upload_size
id2023389
size43,523
KOLOGO B Josias Yannick (dev-josias)

documentation

README

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

at your option.

Commit count: 132

cargo fmt