1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use Arc;
use fmt;
use crateState;
/// The source the input ranges refer to.
///
/// Formats can publish the byte range in the input of every event (see
/// [`State::input_range`](crate::State::input_range)). This is cheap, but
/// resolving the ranges into lines and columns (see
/// [`Position::of`](crate::Position::of)) requires the source. As
/// this requires a copy of the input, formats only provide it when asked to
/// (for instance with their `track_locations` option). They store it in
/// the [`State`] as an extension value with [`set`](Self::set) before they
/// emit the first event:
///
/// ```
/// use deser::de::DeserializeDriver;
/// use deser::Source;
///
/// let mut out = None::<bool>;
/// let mut driver = DeserializeDriver::new(&mut out);
/// Source::set(driver.state_mut(), "true");
/// assert_eq!(&*driver.state().get::<Source>().unwrap().0, "true");
/// ```
;