Struct scan_rules::scanner::Inferred
[−]
[src]
pub struct Inferred<T>(_);
Explicitly infer the type of a scanner.
This is useful in cases where you want to only partially specify a scanner type, but the partial type cannot be inferred under normal circumstances.
For example, tuples allow their element types to scan to be abstract scanners; e.g. (Word<String>, Hex<i32>)
will scan to (String, i32)
. However, this interferes with inferring the scanner type when you partially specify a tuple type. If you attempt to store the result of scanning (_, _)
into a (String, i32)
, Rust cannot determine whether the scanner type should be (String, Hex<i32>)
, or (Word<String>, i32)
, or something else entirely.
This scanner, then, requires that the inner type scan to itself and only to itself.
Trait Implementations
impl<'a, T> ScanFromStr<'a> for Inferred<T> where
T: ScanSelfFromStr<'a>,
[src]
T: ScanSelfFromStr<'a>,
type Output = T
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