armanriazirustsyntaxnames
'turbofish': ::<>() , ::. Combined with the (angular brackets=Bound) for generics
'fully qualified syntax' : <Type as Trait>::function(receiver_if_method, next_arg, ...);
'path': ::
'closure': <> , || {} , Closures are represented by traits, so they cannot be a return type, let consume_and_return_x = move || x;
'&': borrow
'*': dereference
'!': that’s known in type theory lingo as the empty type because it has no values. We prefer to call it the never type.Functions that return never are called diverging functions.
'$str': literal string
''a': lifetime a, lifetime=timetolive=subset of their scope, &'a mut i32 // a mutable reference with an explicit lifetime
'implicit': encapsulation (like method, copy)
'bound' : 'where Self: Sized'
'DSTs': unsized types
'?Sized': T may or may not be Sized-Trait syntax with this meaning is only available for Sized, this notation overrides the default that generic types must have a known size at compile time. not any other traits.
'The associated type = placeholder type' : is named Item'pub trait Iterator {type Item;}'another example is ' HasAssocType<Ty = T>'
'default type parameters = right hand side' : Example
```trait Add<Rhs=Self> { type Output; fn add(self, rhs: Rhs) -> Self::Output;}```
```another example:
'thin wrapper around the type' : part of Vec<String> is noticed. struct Wrapper(Vec<String>);
'newtype pattern = wrapper type = NewPattern ' : thin wrapping of an existing type in another struct
impl Add<Meters> for Millimeters {type Output = Millimeters;fn add(self, other: Meters) -> Millimeters {}}
// we specify impl Add<Meters> to set the value of the Rhs type parameter instead of using the default of Self
```
'receiver' : for exampele of type of Self (i.e. self) implies this
'impl<T, U> GenericTrait<U> for u32 where U: HasAssocType<Ty = T> {}'
/*The syntax for specifying a default type for a generic type is <PlaceholderType=ConcreteType> when declaring the generic type.*/
/* 'T' ""constrains"" by being in an ""associated type(Ty = T)"" in a bound for type `U` which is itself a ""generic parameter(GenericTrait<U>)"" constraining the trait.*/
---
Rust has a feature called automatic referencing and dereferencing.
Calling methods is one of the few places in Rust that has this behavior.
p1.distance(&p2);
(&p1).distance(&p2);
----
In Rust, global variables are called static variables
----
https://doc.rust-lang.org/nightly/reference/glossary.html
https://doc.rust-lang.org/reference/notation.html
ArmanRiazi