error private-in-public
Тип в сигнатуре менее видим, чем само объявление.
What it means#
A type used in the signature of a visible declaration MUST be at least as visible as the declaration itself (§2.3). Otherwise callers would have to name a type they cannot see.
Example#
data Internal { id: u64 }
pub fn make() -> Internal { // <- private-in-public
Internal{ id: 1 }
}error
private-in-public
How to fix#
pub data Internal { id: u64 }
pub fn make() -> Internal {
Internal{ id: 1 }
}Make the type as visible as the function, or make the function less visible. For pub(api) functions every type in the signature must be pub(api) too.