pub struct Inferred<T>(/* private fields */);
Expand description
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§
Source§impl<'a, T> ScanFromStr<'a> for Inferred<T>where
T: ScanSelfFromStr<'a>,
impl<'a, T> ScanFromStr<'a> for Inferred<T>where
T: ScanSelfFromStr<'a>,
Source§type Output = T
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
Source§fn scan_from<I: ScanInput<'a>>(s: I) -> Result<(Self::Output, usize), ScanError>
fn scan_from<I: ScanInput<'a>>(s: I) -> Result<(Self::Output, usize), ScanError>
Perform a scan on the given input. Read more
Source§fn wants_leading_junk_stripped() -> bool
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
Auto Trait Implementations§
impl<T> Freeze for Inferred<T>
impl<T> RefUnwindSafe for Inferred<T>where
T: RefUnwindSafe,
impl<T> Send for Inferred<T>where
T: Send,
impl<T> Sync for Inferred<T>where
T: Sync,
impl<T> Unpin for Inferred<T>where
T: Unpin,
impl<T> UnwindSafe for Inferred<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more