Skip to content

Commit

Permalink
temp2
Browse files Browse the repository at this point in the history
  • Loading branch information
dralley committed Aug 14, 2022
1 parent 553a9ef commit 10038ca
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions src/reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,56 +306,6 @@ impl<R> Reader<R> {
/// Consumes `Reader` returning the underlying reader
///
/// Can be used to compute line and column of a parsing error position
///
/// # Examples
///
/// ```
/// # use pretty_assertions::assert_eq;
/// use std::{str, io::Cursor};
/// use quick_xml::Reader;
/// use quick_xml::events::Event;
///
/// let xml = r#"<tag1 att1 = "test">
/// <tag2><!--Test comment-->Test</tag2>
/// <tag3>Test 2</tag3>
/// </tag1>"#;
/// let mut reader = Reader::from_reader(Cursor::new(xml.as_bytes()));
/// let mut buf = Vec::new();
///
/// fn into_line_and_column(reader: Reader<Cursor<&[u8]>>) -> (usize, usize) {
/// let end_pos = reader.buffer_position();
/// let mut cursor = reader.into_inner();
/// let s = String::from_utf8(cursor.into_inner()[0..end_pos].to_owned())
/// .expect("can't make a string");
/// let mut line = 1;
/// let mut column = 0;
/// for c in s.chars() {
/// if c == '\n' {
/// line += 1;
/// column = 0;
/// } else {
/// column += 1;
/// }
/// }
/// (line, column)
/// }
///
/// loop {
/// match reader.read_event_into(&mut buf) {
/// Ok(Event::Start(ref e)) => match e.name().as_ref() {
/// "tag1" | "tag2" => (),
/// tag => {
/// assert_eq!("tag3", tag);
/// assert_eq!((3, 22), into_line_and_column(reader));
/// break;
/// }
/// },
/// Ok(Event::Eof) => unreachable!(),
/// _ => (),
/// }
/// buf.clear();
/// }
/// ```
pub fn into_inner(self) -> R {
self.reader
}
Expand Down

0 comments on commit 10038ca

Please sign in to comment.