Re-export item through intermediate public module where it's not visible

⚓ rust    📅 2025-07-15    👤 surdeus    👁️ 3      

surdeus

This is mainly an aesthetic issue.

Is it possible to have a pub struct C defined in a::b::c where a and b are pub and then re-export C in a but C is not visible in b?

I want the user of the lib only to be able to access C through its re-export a::C, and not via a::b::C or a::b::c::C. However, the user may import other members of a::b like a::b::X, which is why I need b to be pub as well.

3 posts - 2 participants

Read full topic

🏷️ rust_feed