AmitKumarDas / Decisions

Apache License 2.0
10 stars 3 forks source link

ref: rust snippets #270

Open AmitKumarDas opened 3 years ago

AmitKumarDas commented 3 years ago
AmitKumarDas commented 3 years ago

muscle memory

- :: used in imports
- :: used invoke static functions
- : used to separate variable name from type
- name: type
- &Str is the string literal
- &var is the immutable reference
- fn to define a function
- ; to end the line
 - statically allocated string
 - --bin to build an executable instead of using as a library
 - ::funcname() // function associated of a particular type instead of its instance
 - ::funcname() // called as static method in some languages
 - use std::io // associated functions can be used in import statements as well
 - std::io::stdin() // nested notation for associated function
 - std::io::stdin() // returns std::io::Stdin handle
 - &var // is a immutable reference
 - &mut var // is a mutable reference