Title: Theory / Unimportant / CS / Programming / Rust / Reference
On every note of this deck, unless a note says otherwise:
Page: https://doc.rust-lang.org/reference/macros.html
Page: https://doc.rust-lang.org/reference/macros.html

Question: What is rust encoding
Answer: UTF-8
Page: https://doc.rust-lang.org/reference/input-format.html
Chapter: 1
Context: Rust

Question: The category of keywords
Answer: Strict keywords
Page: https://doc.rust-lang.org/reference/keywords.html
Chapter: 1
Section: Either
Context: Rust
Answer2: Reserved keywords
Answer3: weak keyword

Name: A strict keyword
Definition: A keyword that can not be a name, must only be used in its correct context
Page: https://doc.rust-lang.org/reference/keywords.html
Chapter: 1
Context: Rust

Name: Reserved keyword
Definition: A keyword that may be used in future version of rust. Can't be used anywhere in the program
Page: https://doc.rust-lang.org/reference/keywords.html
Chapter: 1
Context: Rust

Name: Weak keyword
Definition: A keyword only in some context. Otherwise can be used as a name
Page: https://doc.rust-lang.org/reference/keywords.html
Chapter: 1
Context: Rust

Name: IDENTIFIER_OR_KEYWORD
Definition: XID_START XID_CONTINUE*
Page: https://doc.rust-lang.org/reference/keywords.html
Chapter: 1
Context: Rust
Definition2: _ XID_Continue+
Conjdef: Either

Name: NON_KEYWORD_IDENTIFIER
Definition: IDENTIFIER_OR_KEYWORD except a strict or reserved keyword
Page: https://doc.rust-lang.org/reference/keywords.html
Chapter: 1
Context: Rust

Name: IDENTIFIER
Definition: NON_KEYWORD_IDENTIFIER
Page: https://doc.rust-lang.org/reference/keywords.html
Chapter: 1
Context: Rust
Definition2: RAW_IDENTIFIER
Conjdef: Either

Name: Free-form language
Definition: A language where each whitespace is similar, indentation don't matter
Page: https://doc.rust-lang.org/reference/whitespace.html
Chapter: 1
Context: Programming
Conjdef: Either

Instruction: r########"foo"######## (same number of # on both sides)
Page: https://doc.rust-lang.org/reference/tokens.html
Language: rust
Chapter: 1
Returns: the raw literal foo.

Name: DelimTokenTree
Definition: A sequence of TokenTree, included in a pair of matching delimiters
Page: https://doc.rust-lang.org/reference/tokens.html
Chapter: 1
Name2: MacroTranscriber

Name: Delimiter
Definition: Either [], () or {}
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3

Name: MacroInvocation
Definition: SimplePath!DelimTokenTree
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3

Name: TokenTree
Definition: Token except delimiters
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Definition2: DelimTokenTree
Conjdef: Either

Name: MacroInvocationSemi
Definition: SimplePath!(TokenTree*);
SimplePath![TokenTree*];
SimplePath!{TokenTree*}
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Name: MacroRepOp
Definition: * | + | ?
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Name: MacroRepSep
Definition: Tokenexcept delimiters and MacroRepOp
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Name: MacroFragSpec
Definition: block | expr | ident | item | lifetime | literal   | meta | pat | pat_param | path | stmt | tt | ty | vis
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Name: MacroMatch
Definition: Token except $ and delimiters
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Definition2: MacroMatcher
Conjdef: Either
Definition3: $(IDENTIFIER_OR_EYWORK except crate| RAW_IDENTIFIER|_) : MacroFragSpec
Definition4: $(MacroMatch+) MacroRepSep? MacroRepOp

Name: MacroMatcher
Definition: Delimiters containing a sequence of MacroMatch
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Name: MacroRule
Definition: MacroMatcher => MacroTranscriber
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Name: MacroRules
Definition: A sequence of ;-separated MacroRule
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Name: MacroRulesDef
Definition: delimiters containing MacroRules, followed by ; if necessary
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Name: MacroRulesDefinition
Definition: macro_rules! IDENTIFIER MacroRulesDef
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Conjdef: Either

Question: Constraint on macro pattern
Answer: It must be unambiguous while reading one token at a time.
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Extra: E.g. `x* x` is not acceptable, as, while reading a token x, it is not clear whether it's part of the sequence, or the last one. On the other hand, `x x*` is acceptable

Question: Restriction on using macro in macro-by-example
Answer: The inner-most macro can't use literal in its matcher, unless it is send an argument which is of type: ident, lifetime or tt
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3

Typ: item
Meaning: Match any Item
Language: rust
Chapter: 3
Context: macro

Typ: block
Meaning: Match any BlockExpression
Language: rust
Chapter: 3
Context: macro

Typ: stmt
Meaning: a Statement without the trailing semicolon (except for item statements that require semicolons)
Language: rust
Chapter: 3
Context: macro

Typ: pat_param
Meaning: a PatternNoTopAlt
Language: rust
Chapter: 3
Context: macro

Typ: pat
Meaning: At least any PatternNoTopAlt and possibly more depending on edition
Language: rust
Chapter: 3
Context: macro

Typ: expr
Meaning: An Expression
Language: rust
Chapter: 3
Context: macro

Typ: ty
Meaning: a Type
Language: rust
Chapter: 3
Context: macro

Typ: ident
Meaning: an IDENTIFIER_OR_KEYWORD or RAW_IDENTIFIER
Language: rust
Chapter: 3
Context: macro

Typ: path
Meaning: a TypePath style path
Language: rust
Chapter: 3
Context: macro

Typ: tt
Meaning: A TokenTree
Language: rust
Chapter: 3
Context: macro

Typ: meta
Meaning: an Attr, the contents of an attribute
Language: rust
Chapter: 3
Context: macro

Typ: lifetime
Meaning: a LIFETIME_TOKEN
Language: rust
Chapter: 3
Context: macro

Typ: vis
Meaning: a possibly empty Visibility qualifier
Language: rust
Chapter: 3
Context: macro

Typ: literal
Meaning: matches -?LiteralExpression
Language: rust
Chapter: 3
Context: macro

Instruction: $crate
Page: https://doc.rust-lang.org/reference/macros.html
Language: rust
Context: macro
Chapter: 3
Returns: The current crate

Variable: $var:type
Meaning: Matches any value of type and associate it to $var
Context: macro
Language: rust
Chapter: 3

Variable: $(matcher)separator*
Meaning: matches any number of matcher, separated by separator
Context: macro
Language: rust
Chapter: 3

Variable: $(matcher)separator+
Meaning: matches at least one matcher, separated by separator
Context: macro
Language: rust
Chapter: 3

Variable: $(matcher)?
Meaning: matches one or zero matcher
Context: macro
Language: rust
Chapter: 3

Variable: $(matcher)+
Meaning: matches at least one matcher, without separator
Context: macro
Language: rust
Chapter: 3

Variable: $(matcher)*
Meaning: matches any number of matcher, without separator
Context: macro
Language: rust
Chapter: 3

Name: A metavariable
Definition: A variable used in a macro, representing part of the code
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Context: macro, rust

Question: What occurs if a macro is defined multiple time
Answer: Last definition in scope is used
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Context: macro, rust

Name: transcriber
Definition: The part of a macro that generates some code
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 3
Context: rast, macro

Instruction: (code)*
Page: https://doc.rust-lang.org/reference/macros.html
Language: rust
Context: rast, macro
Chapter: 3
Returns: code repeated as many time as there are values for the variables inside of this parenthesis

Instruction: macro_rules! name {
  matcher_1 => code_1
  ...
  matcher_n => code_n
}
Page: https://doc.rust-lang.org/reference/macros.html
Meaning: A macro, with name, that, if matching matcher_i, output code_i
Language: rust
Chapter: 3
Context: rast, macro

Instruction: #[macro_use]
mod name {}
Page: https://doc.rust-lang.org/reference/macros.html
Meaning: All macros in this module are in scope when the module close
Language: rust
Chapter: 3
Context: rast, macro
Similar to: mod name {}

Instruction: #[macro_use]
extern crate foo;
Page: https://doc.rust-lang.org/reference/macros.html
Meaning: All macros of foo are directly in scope
Language: rust
Chapter: 3
Context: rast, macro

Instruction: #[macro_use(name)]
extern crate foo;
Page: https://doc.rust-lang.org/reference/macros.html
Meaning: Macro foo::name can be referenced as name
Language: rust
Chapter: 3
Context: rast, macro

Question: Crates is a unit for which operations
Answer: Compilation
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 4
Context: Rust
Answer2: Linking
Answer3: versioning
Answer4: distribution
Answer5: runtime loading

Question: Types that implements std::process::Termination
Answer: ()
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 4
Context: Rust
Answer2: !
Answer3: Infallible
Answer4: ExitCode
Answer5: Result<Termination, Debug>

Question: Type of return of main
Answer: impl std::process::Termination, ! or none
Page: https://doc.rust-lang.org/reference/macros.html
Chapter: 4
Context: Rust

Name: Crate
Definition: UTF8BOM?
Page: https://doc.rust-lang.org/reference/crates-and-source-files.html
Chapter: 4
Context: Rust
Definition2: SHEBANG?
Conjdef: In this order
Definition3: InnerAttribute*
Definition4: Item*

Name: Conditionally compiled source code
Definition: Part of the source code that may or may not be compiled
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Chapter: 5
Context: Rust
Conjdef: In this order

Name: ConfigurationPredicateList
Definition: ,-separated list of ConfigurationPredicate
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Chapter: 5
Context: Rust, Conditional compilation

Name: ConfigurationOption
Definition: IDENTIFIER = STRING_LITERAL
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Chapter: 5
Context: Rust, Conditional compilation
Definition2: IDENTIFIER
Conjdef: Either

Name: ConfigurationPredicate
Definition: ConfiguartionOption
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Chapter: 5
Context: Rust, Conditional compilation
Definition2: ConfiguartionAll
Conjdef: Either
Definition3: ConfigurationAny
Definition4: ConfigurationNot

Instruction: not (configuration)
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Effect: A predicate that holds iff configuration does not hold
Context: Rust, Conditional compilation
Chapter: 5
Name: ConfigurationNot

Instruction: all (configuration_1, ..., configuration_n)
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Effect: A predicate that holds iff each of the configuration_i holds
Context: Rust, Conditional compilation
Chapter: 5
Name: ConfigurationAll

Instruction: any (configuration_1, ..., configuration_n)
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Effect: A predicate that holds iff at least one of the configuration_i holds
Context: Rust, Conditional compilation
Chapter: 5
Name: ConfigurationAny

Instruction: IDENTIFIER
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Effect: Holds iff IDENTIFIER is set
Language: RUST
Context: Conditional compilation, condition
Chapter: 5

Instruction: IDENTIFIER = literal
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Effect: Holds iff IDENTIFIER is set to literal
Language: RUST
Context: Conditional compilation, condition
Chapter: 5

Instruction: #[cfg(condition)]
code
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Effect: code if condition holds, otherwise, nothing
Language: RUST
Chapter: 5

Instruction: #[cfg_attr(condition), attribute_1, ..., attribute_n]
code
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Effect: if condition then
#[attribute_1]
...
#[attribute_n]
code
Otherwise, just code
Language: RUST
Chapter: 5

Instruction: cfg!(condition)
Page: https://doc.rust-lang.org/reference/conditional-compilation.html
Language: RUST
Chapter: 5
Returns: Whether condition holds

Name: A special type/trait
Definition: Box<T>
Page: https://doc.rust-lang.org/reference/special-types-and-traits.html
Chapter: 11
Context: Rust
Definition2: Rc<T>, Arc<T>
Conjdef: A type/trait that can't be user defined, and is treated specially by the compiler. All of
Definition3: Pin<P>
Definition4: UnsafeCell<T>
Definition5: PhatonData<T>
Definition6: Operator traits
Definition7: Deref and DerefMut
Definition8: Drop
Definition9: Copy/Clone
Definition10: Send/Sync
Definition11: Termination
Definition12: Auto traits
Definition14: Sized

Question: What is the memory model of rust
Answer: it has none
Page: https://doc.rust-lang.org/reference/memory-model.html
Chapter: 13
Context: Rust

Name: An item of a program
Definition: functions, modules, and types that have their value calculated at compile-time and stored uniquely in the memory image of the rust process.
Page: https://doc.rust-lang.org/reference/memory-model.html
Chapter: 13
Context: Rust

Name: A variable
Definition: named function parameter,
Page: https://doc.rust-lang.org/reference/memory-model.html
Chapter: 13
Context: Rust
Definition2: an anonymous temporary,
Conjdef: A component of a stack frame, either
Definition3: a named local variable.

Name: A local variable
Definition: A variable that holds a value directly, allocated within the stack's memory
Page: https://doc.rust-lang.org/reference/memory-model.html
Chapter: 13
Context: Rust
Name2: STack-local allocation

Question: When is a local variable allocated
Answer: on frame-entry
Page: https://doc.rust-lang.org/reference/memory-model.html
Chapter: 13
Context: Rust