From fe3ded6a58dc07e5158ede47912a039ac25cd8af Mon Sep 17 00:00:00 2001 From: Daniel Xu Date: Tue, 17 Sep 2024 16:31:17 +0200 Subject: [PATCH] libbpf-rs: Generate docs for impls on type alias rustdoc apparently cannot generate docs for methods implemented on a type alias target unless said type alias is exported from the crate. I think it's b/c under the hood rustdoc is using some clever javascript tricks to inline documentation. They do this to avoid HTML bloat for crates with lots of type alises [0]. The upshot of this is now trait impls like `AsFd` are visible in web docs. This is really important, as otherwise it's quite difficult for users to discover these APIs. The downside of this approach is we publically expose implementation structs in docs. It's not a huge deal, as with skeleton it should be fairly obvious what types they should actually interact with. I kinda doubt anyone reads the docs front to back. [0]: https://github.com/rust-lang/rust/pull/116471 --- libbpf-rs/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libbpf-rs/src/lib.rs b/libbpf-rs/src/lib.rs index 29c9d137..8fd3ad6e 100644 --- a/libbpf-rs/src/lib.rs +++ b/libbpf-rs/src/lib.rs @@ -115,8 +115,10 @@ pub use crate::map::MapHandle; pub use crate::map::MapInfo; pub use crate::map::MapKeyIter; pub use crate::map::MapMut; +pub use crate::map::MapImpl; pub use crate::map::MapType; pub use crate::map::OpenMap; +pub use crate::map::OpenMapImpl; pub use crate::map::OpenMapMut; pub use crate::object::AsRawLibbpf; pub use crate::object::MapIter; @@ -132,10 +134,12 @@ pub use crate::print::PrintCallback; pub use crate::print::PrintLevel; pub use crate::program::Input as ProgramInput; pub use crate::program::OpenProgram; +pub use crate::program::OpenProgramImpl; pub use crate::program::OpenProgramMut; pub use crate::program::Output as ProgramOutput; pub use crate::program::Program; pub use crate::program::ProgramAttachType; +pub use crate::program::ProgramImpl; pub use crate::program::ProgramMut; pub use crate::program::ProgramType; pub use crate::program::TracepointOpts;