Doc for private functions

How to generate doc-description for private function?
Flag --document-private-items not working.

Cargo.toml :

name = "libmy_sys"
path = "src/"
rustdocflags = ["--document-private-items"] :

extern {
    /// Foo
    /// # Arguments
    /// * `bar` - lorem ipsum
    fn My_init_function( bar: *const c_char ) -> c_uchar;

cargo doc --open


External blocks provide declarations of items that are not defined in the current crate and are the basis of Rust's foreign function interface. These are akin to unchecked imports.

There's no point in exposing documentation in your codebase on these. It's not coming from your code.

rustdocflags is not a valid Cargo.toml key. You need to invoke cargo doc --document-private-items --open or set the RUSTDOCFLAGS environment variable, or modify .cargo/config.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.