4 releases (2 breaking)
Uses new Rust 2024
| new 0.3.0 | Mar 5, 2026 |
|---|---|
| 0.2.0 | Jan 7, 2026 |
| 0.1.1-preview.1 | Feb 8, 2026 |
| 0.1.0 | Jul 30, 2025 |
#7 in #axvisor
701 downloads per month
Used in 11 crates
(via axvisor_api)
9KB
53 lines
Procedural macros for the axvisor_api crate.
This crate provides the procedural macros used to define and implement
AxVisor API interfaces. These macros are built on top of the
crate_interface crate and provide a convenient way to create
link-time-resolved API interfaces.
Macros
Usage
This crate is re-exported by axvisor_api and should not be used directly.
Instead, use the macros through axvisor_api:
use axvisor_api::{api_def, api_impl};
#[api_def]
pub trait MyApiIf {
fn my_function() -> u32;
}
struct MyApiImpl;
#[api_impl]
impl MyApiIf for MyApiImpl {
fn my_function() -> u32 {
42
}
}
How It Works
The macros use crate_interface under the hood, which leverages Rust's
link-time symbol resolution to connect API definitions with their
implementations. This allows for a cleaner API without explicit generic
parameters.
axvisor-api-macros
Attribute Macros for Automated API Trait Generation and Cross-Module Binding
DO NOT use this crate directly, use the [axvisor_api] crate instead.
License
Axvisor_api is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
Dependencies
~2.1–2.8MB
~65K SLoC