pub struct IoReader<R: BufRead> { /* private fields */ }
Available on crate feature
serialize
only.Expand description
XML input source that reads from a std::io input stream.
You cannot create it, it is created automatically when you call
Deserializer::from_reader
Implementations§
Source§impl<R: BufRead> IoReader<R>
impl<R: BufRead> IoReader<R>
Sourcepub const fn get_ref(&self) -> &Reader<R>
pub const fn get_ref(&self) -> &Reader<R>
Returns the underlying XML reader.
use serde::Deserialize;
use std::io::Cursor;
use quick_xml::de::Deserializer;
use quick_xml::Reader;
#[derive(Deserialize)]
struct SomeStruct {
field1: String,
field2: String,
}
// Try to deserialize from broken XML
let mut de = Deserializer::from_reader(Cursor::new(
"<SomeStruct><field1><field2></SomeStruct>"
// 0 ^= 28 ^= 41
));
let err = SomeStruct::deserialize(&mut de);
assert!(err.is_err());
let reader: &Reader<Cursor<&str>> = de.get_ref().get_ref();
assert_eq!(reader.error_position(), 28);
assert_eq!(reader.buffer_position(), 41);
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for IoReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for IoReader<R>where
R: RefUnwindSafe,
impl<R> Send for IoReader<R>where
R: Send,
impl<R> Sync for IoReader<R>where
R: Sync,
impl<R> Unpin for IoReader<R>where
R: Unpin,
impl<R> UnwindSafe for IoReader<R>where
R: 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