pixix4 / ev3dev-lang-rust

Rust language bindings for http://ev3dev.org
MIT License
74 stars 14 forks source link

Document code hidden behind `screen` feature #22

Closed JohnTheCoolingFan closed 1 year ago

JohnTheCoolingFan commented 2 years ago

This will show the API on docs.rs. Just use #[cfg(any(feature = "screen", doc))]. Maybe I'll do a PR later

mwobat commented 1 year ago

Unfortunately, replacing all #[cfg(feature = "screen")] with #[cfg(any(feature = "screen", doc))] results in an error:

>cargo doc
...
error[E0463]: can't find crate for `framebuffer`
  --> src\lib.rs:37:1
   |
37 | extern crate framebuffer;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `image`
  --> src\lib.rs:40:1
   |
40 | extern crate image;
   | ^^^^^^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not document `ev3dev-lang-rust`

Besides that, I think it would be important to show that the "screen" feature is needed. Example: image However, the required "doc_cfg" feature is still experimental

pixix4 commented 1 year ago

Thanks for the suggestions. This is now implemented. docsrs seems to use nightly rust by default. And with #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] the automatic feature documentation for docsrs can be enabled conditionally.