Title: Theory / Unimportant / CS / Programming / Rust / Library / ops
Tags: automatedNewLineAfterCommaSpace
On every note of this deck, unless a note says otherwise:
Page: https://doc.rust-lang.org/std/ops/index.html
Page: https://doc.rust-lang.org/std/ops/index.html

Typ: FnOnce(args) -> resultType
Meaning: Trait of closure that can be called at least once
Page: https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html
Language: Rust
Chapter: 10

Typ: FnMut(args) -> resultType
Meaning: Trait of closure that mutable borrows
Page: https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html
Language: Rust
Chapter: 10
Subtype of: FnOnce

Typ: Fn(args) -> resultType
Meaning: Trait of closure that borrows (non mutably)
Page: https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html
Language: Rust
Chapter: 10
Subtype of: FnMut

Question: Which operator can be overloaded
Answer: The one backed by a trait
Page: https://doc.rust-lang.org/std/ops/index.html
Context: rust

Question: What's best practice when implementing Trait<T>
Answer: Having T clonable so that we don't have to take ownership, and add<&T> to avoid cloning when possible
Page: https://doc.rust-lang.org/std/ops/index.html
Context: rust

Typ: Add
Meaning: Type that can be added
Context: rust

Typ: Add::Output
Meaning: Output of adding this value to something
Page: https://doc.rust-lang.org/std/ops/index.html
Context: rust

Typ: FooAssign
Meaning: Type to implement foo=
Function: fn foo_assign(&mut self, rhs: Rhs);
Language: rust

Typ: Sub
Meaning: Type to implement -
Function: fn sub_assign(self, rhs: Self);

Typ: Shr
Meaning: Allow to implement right shift operator >>
Function: fn shr(self, rhs: Rhs) -> Self::Output;

Typ: Shl
Meaning: Allow to implement left shift operator <<
Function: fn shr(self, rhs: Rhs) -> Self::Output;

Typ: Rem
Meaning: Allow to implement remainder operator %
Function: fn rem(self, rhs: Rhs) -> Self::Output;

Typ: Neg
Meaning: Allow to implement unary negation operator -
Function: fn neg(self) -> Self::Output;

Typ: Not
Meaning: Allow to implement unary negation operator !
Function: fn neg(self) -> Self::Output;

Typ: Mul
Meaning: Allow to implement multiplication
Function: fn mul(self, rhs: Rhs) -> Self::Output;

Typ: Index
Meaning: Used for indexing operations (container[index]) in immutable contexts.
Function: fn index(&self, index: Idx) -> &Self::Output;

Typ: IndexMut
Meaning: Used for indexing operations (container[index]) in mutable contexts.
Function: fn index(&mut self, index: Idx) -> &Self::Output;

Typ: RangeBounds<T>
Meaning: implemented by Rust’s built-in range types, produced by range syntax like .., a.., ..b, ..=c, d..e, or f..=g.
Function: fn start_bound(&self) -> Bound<&T>;
fn end_bound(&self) -> Bound<&T>;
Function2: fn contains<U>(&self, item: &U) -> bool
    where
        T: PartialOrd<U>,
        U: PartialOrd<T> + ?Sized,
    { ... }

Instruction: range_bound.start_bound()
Returns: the start value as a Bound.
Variables: range_bound : RangeBounds<T>
Typ: RangeBounds<T>

Instruction: range_bound.end_bound()
Returns: the end value as a Bound.
Variables: range_bound : RangeBounds<T>

Instruction: range_bound.contains(item)
Returns: Whether the range bound contains item
Variables: range_bound : RangeBounds<T>

Typ: Bounds<T>
TypMeaning: A bound of a RangeBounds
Page: https://doc.rust-lang.org/std/ops/index.html
Value: Included(T)
Value2: Excluded(T)
Value3: Unbounded

Typ: Drop
Meaning: have an explicit method to run when the value is out of scope
Function: fn drop(&mut self);

Typ: Did
Meaning: Implements /
Function: fn div(self, rhs: Rhs) -> Self::Output;

Typ: BitXor
Meaning: implements bitwise xor ^
Function: fn bitxor(self, rhs: Rhs) -> Self::Output;

Typ: BitXor
Meaning: implements bitwise or |
Function: fn bitor(self, rhs: Rhs) -> Self::Output;

Typ: BitAnd
Meaning: implements bitwise and &
Function: fn bitand(self, rhs: Rhs) -> Self::Output;

Typ: Add
Meaning: implements addition +
Function: fn add(self, rhs: Rhs) -> Self::Output;

Instruction: RangeFrom<Idx>(start)
Returns: A range containing start and everything above

Instruction: RangeFull
Returns: A range containing everything
Abbreviation: ..

Instruction: Range{ start: start, end: end}
Returns: A range containing start included and up to end excluded

Instruction: RangeTo<Idx>(end)
Returns: A range containing everything below end

Instruction: RangeInclusive::new(
  start,
  end
)
Returns: A range containing everything from start to end included

Typ: ControlFlow<B, C=()>
TypMeaning: tell an operation whether it should exit early or go on as usual.
Page: https://doc.rust-lang.org/std/ops/index.html
Language: Rust
Value: Continue(C)
Value2: Break(B)

Instruction: RangeToInclusive<Idx>(end)
Language: Rust
Returns: A range including up to end

Typ: Deref<Target = U>
Meaning: immutable dereferencing operations, like *v to type Self::Target
Function: fn deref(&self) -> &Self::Target;
Language: Rust

Typ: DerefMut<Target = U>
Meaning: immutable dereferencing operations, like *v to type &mut Self::Target
Function: fn deref(&self) -> &mut Self::Target;
Language: Rust