Rewrites standard-library calls that are other Rusty-Elixir into that Rusty-Elixir, before
RustQ.Meta.Ownership and lowering see a body, so lowering keeps to forms Rust has:
Map.new/1,2,MapSet.new/1,2, andEnum.into/2,3into an empty collection are a comprehension collecting into it;Enum.group_by/2,3is a map filled by a loop, andEnum.uniq/1andEnum.uniq_by/2keep the items a set has not seen;- a generator over
Enum.with_index(list)enumerates the list in place.
Where a rewrite needs what only lowering knows, it leaves an internal form for lowering to
resolve: __rustq_items__(list) iterates a list as its ownership allows, and
__rustq_owned__(item, list) is an item of list, copied where that costs nothing and
cloned otherwise.
Summary
Functions
A one-argument function applied to value, inlined: fn name -> name.len() end applied to
item is item.len(), and &key/1 applied to it is key(item).
Rewrites body's standard-library calls that are other Rusty-Elixir.
Functions
A one-argument function applied to value, inlined: fn name -> name.len() end applied to
item is item.len(), and &key/1 applied to it is key(item).
Rewrites body's standard-library calls that are other Rusty-Elixir.