from Introduction to Rust In Rust, there is no Null.

  • If a function doesn’t return anything, instead of null, it returns an empty tuple, also known as “unit.”
    • Unit is
  • Is the functionality of Rust’s Option enum similar to optional in languages like Swift?
  • A clean way to unwrap an optional is like this:
match i32_bag.item {
    Some(v) => println!("found {} in bag!", v),
    None => println!("found nothing"),
- It resembles optional binding.
  • Is there something like Swift’s ”!” in Rust?
    • Yes, there is .unwrap.
      • However, it is naturally discouraged.
      • If it fails, instead of an error, it causes a panic.