pub struct Source(pub Arc<str>);Expand description
The source the input ranges refer to.
Formats can publish the byte range in the input of every event (see
State::input_range). This is cheap, but
resolving the ranges into lines and columns (see
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 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");Tuple Fields§
§0: Arc<str>Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Source
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnsafeUnpin for Source
impl UnwindSafe for Source
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