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)
Trait Implementations
impl<'a, K, V> ScanFromStr<'a> for KeyValuePair<K, V> where K: ScanSelfFromStr<'a>, V: ScanSelfFromStr<'a>
[src]
type Output = (K, V)
The type that the implementation scans into. This does not have to be the same as the implementing type, although it typically will be. Read more
fn scan_from<I: ScanInput<'a>>(s: I) -> Result<(Self::Output, usize), ScanError>
Perform a scan on the given input. Read more
fn wants_leading_junk_stripped() -> bool
Indicates whether or not the scanner wants its input to have leading "junk", such as whitespace, stripped. Read more