epfl-lara / rust-stainless

An experimental Rust frontend for Stainless
Apache License 2.0
6 stars 2 forks source link

Rename stainless collection API to match Rust std #151

Closed yannbolliger closed 3 years ago

yannbolliger commented 3 years ago

Closes #144.

All methods that have the same signature as those in std::collections now also have the same name. Some methods like insert and remove don't have the same return type (because Stainless collections return the newly created collection – they're immutable) but the names are now closer to std.

For the Scala getOrElse and apply there are no direct equivalents. However, as std::collection can be indexed, the apply was named index. getOrElse was named get_or in analogy of unwrap_or from std::option::Option.