Use pub(crate) for crate-wide visibility and pub(super) for parent-module access in Rust.
Use pub(crate) to make an item visible only within the current crate, and pub(super) to make it visible to the immediate parent module.
mod parent {
pub(crate) fn crate_wide() {}
pub(super) fn parent_only() {}
mod child {
pub(super) fn child_to_parent() {}
}
}
These keywords control who can see your code. pub(crate) lets anyone in your project use it, while pub(super) only lets the folder directly above it see it. Think of it like office access: pub(crate) is a badge for the whole building, while pub(super) is a key only for your specific floor.