Struct scan_rules::scanner::KeyValuePair
[−]
[src]
pub struct KeyValuePair<K, V>(_);
An abstract scanner that scans a (K, V)
value using the syntax K: V
.
This scanner is designed to take advantage of three things:
Maps (i.e. associative containers) typically print themselves with the syntax
{key_0: value_0, key_1: value_1, ...}
.Maps typically implement
Extend<(K, V)>
; that is, you can add new items by extending the map with a(K, V)
tuple.Repeating bindings can be scanned into any container that implements
Default
andExtend
.
As such, this scanner allows one to parse a Map
type like so:
scan!(input; "{", [let kvs: KeyValuePair<K, V>],*: Map<_, _>, "}" => kvs)