There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

DWin ,

Oh sorry, I misread what you typed and went on a tangent and just idly typed that in.

One thing you could do for your situation if you’re planning on iterating over some array or vector of items is to use the inbuilt iterators and the chaining syntax. It could look like this


<span style="color:#323232;">let output_array = array.into_iter()
</span><span style="color:#323232;">    .map(|single_item| {
</span><span style="color:#323232;">        // match here if you want to handle exceptions
</span><span style="color:#323232;">    })
</span><span style="color:#323232;">    .collect();
</span>

The collect also only collects results that are Ok(()) leaving you to match errors specifically within the map.

This chaining syntax also allows you to write code that transverses downwards as you perform each operation, rather than transversing to the right via indentation.

It’s not perfect and sometimes it’s felt a bit confusing to know exactly what’s happening at each stage, particularly if you’re trying to debug with something mid way through a chain, but it’s prettier than having say 10 levels of nesting due to iterators, matching results, matching options, ect.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines