E0004#
The abstract type does not occur in public signature of current package,
consider marking it as priv
.
If an abstract type is not used elsewhere in the public interface of a package,
then it is not possible for user to interact with the value of that type in any
way. Therefore, it is highly probable that the type is part of the private
implementation of the package. In this case, it is better to mark the type as
priv
to indicate that it is not part of the public interface of the package.
It is also possible that, this abstract type is part of the public interface of
the package, but relevant functions, methods, or types are not marked as pub
.
Erroneous example#
type Code Int derive(Show)
fn Code::new(value : Int) -> Code {
return value
}
test {
inspect!(Code::new(1), content="Code(1)")
}
Suggestion#
If the abstract type is not part of the public interface of the package, then
it should be marked as priv
:
priv type Code Int derive(Show)
// ...
Or, if the abstract type is part of the public interface of the package, then
make relevant definitions pub
:
type Code Int derive(Show)
pub fn Code::new(value : Int) -> Code {
return value
}