(mem) - Rust
field access expressions
clojure
(mem field? value?)Where:
Matching:
- field access, e.g.
value.field - chained access, e.g.
value.field.subfield
Behavior
- When
valueis provided and the receiver is a chained access, it matches the inner field name (so(mem _ config)matchessettings.config.value).
Examples
Find accesses to secrets on a config struct.
clojure
(mem secret (id config))Selects in lines { 1 } but not in { 2, 3 }:
rust
let token = config.secret;
let token = settings.secret;
let level = config.verbose;Locate chained accesses that go through a config field.
clojure
(mem _ config)Selects in lines { 1 } but not in { 2 }:
rust
let path = settings.config.value;
let path = settings.env.value;Arguments
field
- Identifier: shorthand for (id)
- Pattern: shorthand for (id)
- (id)
- (:into)
- (:nearest)
- (:and)
- (:or)
- (:not)
- (:text)
- (:kind)
- (:replace)
- (:replace-in)
- (:capture)
value
- Identifier: shorthand for (id)
- Pattern: shorthand for (id)
- (:ref)
- (:into)
- (:nearest)
- (:and)
- (:or)
- (:not)
- (:text)
- (:kind)
- (:replace)
- (:replace-in)
- (:capture)
- (call)
- (enum)
- (fun)
- (id)
- (mem)
- (num)
- (str)