Do we have a coding convention/guideline for rust programs? Getting names right is hard but in my opinion it is of utmost importance. The concept of abstraction depends on using a good name as a mnemonic/handle to a larger concept. Also mistakes in choosing good names are hard to rectify down the line.
I propose the following rules to begin with the process of creating such a document (assuming it does not exist)...
I'm not sure if there are any guidelines on that currently.
I know that in the new io module though, all of the structs seem to have been named nouns, the traits have been named verbs, and the methods have been named verbs or plural nouns.
For example:
Write, the trait for something to write to - similarly BufWrite, the trait for something that writes in a buffered way
BufWriter, an implementation of BufWrite.
Write::write, a method to write something to the Write.
or in a different method name case, Read::chars, a method to produce a character iterator from a Read.
But, in another case, structs have also been called verbs. The ones in the io trait using this convention are all iterators, which take the name directly from the methods which produce them.
For example:
Using io::repeat(u8) will produce a Repeat struct
Using BufReader::split(self, u8) will produce a Split struct
Besides those trends, I don't know of any specific guidelines. I think the general consensus is just to go with something which will give the user an idea of what the function will do, and not to have it in any specific part of speech.
This WIP guide is probably what you're looking for. Certain things do have naming conventions but it depends. I don't know of anything dictating verbs vs nouns and such.
It's very bad practice to revive the several-years-old threads instead of creating new ones (with link to the original thread, if it is necessary for context).
In general, it's good practice to follow the common code style, no matter the language, so that your code can be understood by someone else but you. For Rust, this is the style enforced by compiler lints. But if you don't want your code to be easily read by others (only by yourself), then, well, you may use whatever style you want, and there would be no "bad" or "good" practice in any case.
I am confused about right naming convention because different language follow different naming convention for example c#/java have different naming convention when compare to python can anyone explain right naming convention or coding formate for rust language that is officially accepted by rust community
No need to be confused. Or even think about it much. Just edit and compile your code fixing things up as per the suggestions in the compiler warnings until all the yellow squiggles have gone away.
There is a logic to the Rust naming convention which you will soon absorb.
Whilst you are at it use "cargo clippy" and "cargo fmt". With their default settings.
If everyone does that we will end up a happy world where all code you come across is named and formatted consistently.