Skip to content
Beskid The Beskid Book

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

05.3 pub use re-exports

Building a stable public API surface without dumping every internal module."

pub use re-exports

pub use is how you tell the truth about your package API without inviting every consumer into internal/v2/experimental/.

Boundary module at myapp.api:

mod myapp.api;
pub use myapp.core.Service;
pub use myapp.core.Config;
// do NOT pub use myapp.core.HelperHack;

Consumers import from myapp.api, not from twenty leaf modules.

  • You split implementation across files but want one import path for apps
  • You rename internal modules without breaking callers (re-export old names temporarily)
  • You mirror platform-spec “feature hub” style surfaces in libraries
  • Re-exporting everything pub in core because you were lazy
  • Accidentally pub use internal helpers—now they are semver
flowchart LR
  INT[internal modules] --> API[api.bd pub use]
  API --> APP[application imports]

root_namespace in Project.proj is metadata for package naming conventions—it does not replace module paths in source. Keep module declarations honest.

Diagnostics you will see