-
borrowing: a borrowed variable is temporary shared to a function that does not own it (see "reference").
-
dereference: taking ownership on a reference using the dereference operator,
*
. ref -
generics: abstract types that prevent code duplication, i.e.
fn largest<T>(list: &[T]) -> T
ref -
lifetime:
-
mutable:
-
ownership: a way to solve memory allocation issues with no garbage collection: each variable is owned by a single function at a time ref
-
reference: a reference to a variable without taking ownership on it, using that
&
syntax, i.e. this function has a reference to its parameter:fn calculate_length(word: &String)
. ref -
shadowing: creating a new variable with an existing name (i.e.
let x = x + 1; let x = x * 2;
). ref -
slice: data type that does not have ownership ; commonly used for string slices (
let s = "Hello, world!"; // type of s is &str
. ref -
struct: pure data with named fields, i.e.
struct User { username: String, email: String }
ref -
trait: a way to define shared behaviour among types, i.e.
trait Summary { fn summarize(&self) -> String; }
/impl Summary for NewsArticle { //... }
ref -
tuple: a fixed-length compound type, i.e.
let tup = (500, 6.4);
ref
Last active
October 19, 2021 05:45
-
-
Save nicokosi/3f7a7d8a51fdb91ddf2e00c7d2e54ebd to your computer and use it in GitHub Desktop.
Rust glossary
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment