Attribute Macro cpy_binder::cpy_fn

source ·
#[cpy_fn]
Expand description

Macro used to export functions for both C/C++ and Python

Example

#[cpy_fn] // You can also use `#[comment = "Something"]` to document both languages at once
#[comment_c = "@brief Calculates the aspect ratio of a wheel based on its height and width.\n
    @param height Height of the wheel.\n
    @param width Width of the wheel.\n
    @return float Aspect ratio of the wheel.\n"]
#[comment_py = "Calculates the aspect ratio of a wheel based on its height and width.\n
    Args:\n
        height (float): Height of the wheel.\n
        width (float): Width of the wheel.\n
    Returns:\n
        float: Aspect ratio of the wheel.\n"]
fn wheel_size_aspect(height: f32, width: f32) -> f32 {
    (height / width) * 100.0
}