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

Download history 82/week @ 2025-11-13 12/week @ 2025-11-20 53/week @ 2025-11-27 20/week @ 2025-12-04 10/week @ 2025-12-11 42/week @ 2025-12-18 25/week @ 2025-12-25 67/week @ 2026-01-01 86/week @ 2026-01-08 15/week @ 2026-01-15 15/week @ 2026-01-22 524/week @ 2026-01-29 279/week @ 2026-02-05 29/week @ 2026-02-12 153/week @ 2026-02-19 119/week @ 2026-02-26

701 downloads per month
Used in 11 crates (via axvisor_api)

GPL-3.0-or-later OR Apache-2…

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

  • api_def - Define an API interface trait.
  • api_impl - Implement an API interface.

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