zenoh icon indicating copy to clipboard operation
zenoh copied to clipboard

remove internal APIs from public interface

Open milyin opened this issue 1 year ago • 2 comments

Describe the release item

We should not expose internal APIs or at least should explicitly mark them as internal in the documentation (e.g. APIs needed for plugin support only)

The list of APIs to be checked

keyexpr -> get_nonwild_prefix keyexpr -> is_wild keyexpr -> chunks keyexpr -> strip_prefix

publication.rs: Priority::MIN, Priority::MAX, Priority::NUM

WhatAmI matcher

ZenohId -> size, max_size, rand, into_keyexpr, to_le_bytes

milyin avatar Mar 10 '24 15:03 milyin

Consider using #[doc(hidden)] attribute for them

milyin avatar Mar 12 '24 11:03 milyin

WhatAmIMatcher is used as argument for zenoh::scout, so I think it can be removed from the list?

wyfo avatar Apr 29 '24 12:04 wyfo

All functionality which is needed by some external crates but should not be part of public API should be moved into traits available through "internal" mod. Here is an example: https://github.com/eclipse-zenoh/zenoh/pull/1046

milyin avatar May 28 '24 10:05 milyin

from @Mallets:

  • [x] buffers goes to internal
  • [x] ZBytes impl for ZSlice and ZBuf goes to internal
  • [x] zenoh::init goes to internal
  • [x] plugins goes to internal
  • [x] runtime goes to unstable and internal

milyin avatar May 30 '24 12:05 milyin

All functionality which is needed by some external crates but should not be part of public API should be moved into traits available through "internal" mod. Here is an example: #1046

Seems that #[cfg(all(feature = "unstable", feature="internal"))] is enough, no need to complicate with traits

milyin avatar May 31 '24 08:05 milyin

Instead of #[cfg(all(feature = "unstable", feature="internal"))], I think we should annotate unstable items used internally with #[cfg(any(feature = "unstable", feature="internal"))]. It would allow to use "internal" items without needing to build with unstable feature. (Of course, zenoh::internal module would only have #[cfg(feature = "internal)])

wyfo avatar Jun 03 '24 15:06 wyfo