mut
keyword is needed for a variable to be mutable.- Match expression returns a value.
println!
macro is used for output.vec!
is used to create vector.- Debug placeholder
{:?}
to be replaced by whichever type. - Variable is owned by functions, and cleaned up when its owning function ends. Ownership is passed when it is called by another funciton.
- To not pass ownership,
&
is used to denote borrowing. Result
type can hold a value or a error. A value isunwrap()
from the returnedResult
.
liuyinglao / rust-example Goto Github PK
View Code? Open in Web Editor NEWRust Learning Notes