# `RustQ.Meta.Lower.Mutability`
[🔗](https://github.com/elixir-crab/rustq/blob/v1.0.0-rc.19/lib/rustq/meta/lower/mutability.ex#L1)

Which variables lowered Rust changes, so their bindings are `mut`: a `let` whose value a later
statement changes in place, a closure argument its body changes, and an owned argument a
rebinding updates in place, as `scores = Map.put(scores, name, 1)` becomes
`scores.insert(name, 1);`.

# `infer_mutability`

```elixir
@spec infer_mutability([RustQ.Rust.AST.stmt()]) :: [RustQ.Rust.AST.stmt()]
```

Marks the `let`s and closure arguments of a lowered body that it changes `mut`.

# `mark_mutable_pattern_vars`

```elixir
@spec mark_mutable_pattern_vars(RustQ.Rust.AST.pat(), MapSet.t(atom())) ::
  RustQ.Rust.AST.pat()
```

Marks the variables of `pattern` in `mutable_vars` `mut`.

# `mutated_variables`

```elixir
@spec mutated_variables([struct()]) :: MapSet.t(atom())
```

The variables a lowered body changes in place through a statement calling a mutating
method on them, as `scores.insert(name, 1);` does where `scores` was rebound to its update.

# `mutating_method?`

```elixir
@spec mutating_method?(atom()) :: boolean()
```

Whether a method changes its receiver, as std collections' `&mut self` methods do.

# `updated_in_place`

```elixir
@spec updated_in_place(RustQ.Rust.AST.stmt()) :: RustQ.Rust.AST.stmt()
```

A binding of a collection to its update, `map = Map.put(map, key, value)`, as the in-place
change of that collection, `map.insert(key, value);`, where the update takes the collection
at its last use; any other statement unchanged.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
