mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Merge branch 'break-value' into 'master'
Fix a FIXME, break value is now stable See merge request !17
This commit is contained in:
commit
437973edf8
1 changed files with 2 additions and 4 deletions
|
@ -269,14 +269,12 @@ impl Element {
|
||||||
/// Parse a document from an `EventReader`.
|
/// Parse a document from an `EventReader`.
|
||||||
pub fn from_reader<R: BufRead>(reader: &mut EventReader<R>) -> Result<Element> {
|
pub fn from_reader<R: BufRead>(reader: &mut EventReader<R>) -> Result<Element> {
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
let root: Element;
|
|
||||||
|
|
||||||
loop {
|
let root: Element = loop {
|
||||||
let e = reader.read_event(&mut buf)?;
|
let e = reader.read_event(&mut buf)?;
|
||||||
match e {
|
match e {
|
||||||
Event::Empty(ref e) | Event::Start(ref e) => {
|
Event::Empty(ref e) | Event::Start(ref e) => {
|
||||||
root = build_element(e)?; // FIXME: could be break build_element(e)? when break value is stable
|
break build_element(e)?;
|
||||||
break;
|
|
||||||
},
|
},
|
||||||
Event::Eof => {
|
Event::Eof => {
|
||||||
bail!(ErrorKind::EndOfDocument);
|
bail!(ErrorKind::EndOfDocument);
|
||||||
|
|
Loading…
Reference in a new issue