-
-
Notifications
You must be signed in to change notification settings - Fork 182
Description
I just looked up https://docs.rs/uefi/0.16.0/uefi/table/boot/struct.BootServices.html#method.find_handles and was surprised to find out that my imported uefi crate didn't have a find_handles function. I had to look into the source code to realize that find_handles is only available when the "exts" feature is enabled.
docs.rs supports a syntax to specify the required features and make them part of the public documentation. An example is https://docs.rs/ntfs/0.2.0/ntfs/struct.NtfsTime.html#impl-TryFrom%3COffsetDateTime%3E
Steps required:
- Add a
package.metadata.docs.rssection toCargo.tomllike https://github.com/ColinFinck/ntfs/blob/b0058b9b9a19bd6727a8be7ef603d1e4421255ed/Cargo.toml#L40-L42 - Enable the
doc_cfgfeature for the newly addeddocsrsargument: https://github.com/ColinFinck/ntfs/blob/b0058b9b9a19bd6727a8be7ef603d1e4421255ed/src/lib.rs#L37 - Add a corresponding
cfg_attrfor everycfg(feature(...))attribute: https://github.com/ColinFinck/ntfs/blob/b0058b9b9a19bd6727a8be7ef603d1e4421255ed/src/time.rs#L36
This works at least for impls and fns. I had no luck putting this in front of a pub use clause, but this shouldn't be necessary here anyway.
Would be great to see that in the next version of uefi-rs on docs.rs :)