'Naming convention for pub(crate) constructor
I have a struct with two constructors, one for public usage (pub fn new(...)) and one for internal usage (pub(crate) fn new_internal(...)). NB: I use the term "internal" in analogy to C# internal keyword, I don't know what the equivalent Rust term is. The difference between the two methods is given by a check on a &str parameter to verify if its value is a reserved keyword. This check must only occur in the pub(crate) constructor. My question is just for stylistic purposes: is there any naming convention for internal functions to distinguish them from their public variant? In my specific case, how should I name the internal constructor?
Solution 1:[1]
No, AFAIK there are no such conventions.
Generally Rust, due to its strong type system, is among the languages that have lesser need for naming conventions related to types, scope, etc., compared to some other languages.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | at54321 |
