Remove `impl From` from rust doc

I realize that this is likely an issue with the visibility of the method in the library, but I'm not sure how to limit it to the crate.

The documentation shows the following:

However this From implementation is only really used by the library itself to convert to an underlying type.

The relevant section in code looks like this:

pub enum Compatibility {
    /// The task is compatible with the AT command.
    AT = 0,
    /// The task is compatible with Task Scheduler 1.0.
    V1,
    /// The task is compatible with Task Scheduler 2.0.
    V2,
}

use windows::Win32::System::TaskScheduler::TASK_COMPATIBILITY;
impl From<Compatibility> for TASK_COMPATIBILITY {
    fn from(item: Compatibility) -> Self {
        TASK_COMPATIBILITY(item as i32)
    }
}

I was expecting that the documentation would not show the impl From part since it is private. I'm not sure why it is not the case.

Edit: The above code is in a module called settings which lib.rs exposes as pub mod settings. Just in case it is related to the issue.

Any impl of a public trait is both visible and usable by other crates, assuming the types involved are public. I believe #[rustdoc(hidden)] can be used if you don't want the impl to show up in the documentation, but it will still be usable.

1 Like

There's no such thing as a private implementation of a trait. They're always global.

If it's only for internal use, consider making it a pub(crate) method instead of a From implementation.

3 Likes

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.