Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Rust in itself offers many idiomatic principles which makes it unique

  1. Sum Types: Ability to add structures and enumeration as variants inside a parent Enum.
  2. Traits: Offers Polymorphism-like characteristics provided in traditional OOP languages.
  3. Destructive Move: Each block of code can own the object inside the block making it safer and also easily garbage collected. Rust also offers memory safety for pass-by references and enforces strong compiler validations to prevent memory errors.
  4. Predictable Error handling: Rust allows you to return Result type objects which can contain either an OK (success object) or an Error(object). This makes the code more predictable and also reduces the scope of unpredictable errors.
  5. OptionsOptional Value: Rust allows values to be built ergonomically using Options, in many cases values are built over a lifetime or in some cases not at all. Rust solves this problem using the Option type which can be initialized to None and when the option value gets filled it becomes a Some(Value).
  6. Pattern Matching: Rust offers strong Match  pattern syntax which places Arms for a given value. It can use regular datatypes(str, u32, bool), Result, and Options making it more readable for even complex conditions.

...