Comments

If the exported item has Rustdoc comments, these comments will be exported as well, and the script user will see them in the code editor.

/// Documentation for the function.
#[export]
pub fn deg(degrees: f64) -> f64 {
    PI * degrees / 180.0
}

/// Documentation for the Vector type.
#[export]
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Vector {
    /// Documentation for the `vector.x` field.
    pub x: f64,
    pub y: f64,
}

#[export]
impl Vector {
    /// Documentation for the Vector constructor.
    #[export(name = "vec")]
    pub fn new(x: f64, y: f64) -> Self {
        Self { x, y }
    }
}