Skip to content

Import Godot docs for builtin types #584

Open
@Bromeon

Description

@Bromeon

We should not manually write documentation for builtin types like Vector3, Quaternion, Callable, ... -- except in cases where the Rust API differs from Godot's. Otherwise, it would require us to copy-paste large swaths of Godot's docs, only for it to become outdated when upstream changes.

Instead, can automate it by pre-generating documentation in godot-codegen and importing it on demand:

// Generated code
macro_rules! godot_builtin_doc {
    (Quaternion.spherical_cubic_interpolate) => {
        "\n\nSome imported docs from Godot."
    };
    // all the stuff
}
impl Quaternion {
    /// A manually written first part of the doc.
    #[doc = godot_builtin_doc!(Quaternion.spherical_cubic_interpolate)]
    pub fn spherical_cubic_interpolate() {
        ...
    }
}

rustdoc output:

grafik

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: coreCore componentsdocumentationImprovements or additions to documentationfeatureAdds functionality to the library

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions