pub fn read_from<B: BufRead>(reader: B) -> Result<Feed, Error> {
        let mut reader = Reader::from_reader(reader);
        reader.expand_empty_elements(true);

        let mut buf = Vec::new();

        loop {
            match reader.read_event(&mut buf)? {
                Event::Start(element) => {
                    if element.name() == b"feed" {
                        let mut feed = Feed::from_xml(&mut reader, element.attributes())?;

                        for attr in element.attributes().with_checks(false) {
                            if let Ok(attr) = attr {
                                if !attr.key.starts_with(b"xmlns:") || attr.key == b"xmlns:dc" {
                                    continue;
                                }

                                let key = str::from_utf8(&attr.key[6..])?.to_string();
                                let value = attr.unescape_and_decode_value(&reader)?;
                                feed.namespaces.insert(key, value);
                            }
                        }

                        return Ok(feed);
                    } else {
                        return Err(Error::InvalidStartTag);
                    }
                }
                Event::Eof => break,
                _ => {}
            }

            buf.clear();
        }

        Err(Error::Eof)
    }
/// Attempt to read an Atom feed from the reader.
///
/// # Examples
///
/// ```no_run
/// use std::io::BufReader;
/// use std::fs::File;
/// use atom_syndication::Feed;
///
/// let file = File::open("example.xml").unwrap();
/// let feed = Feed::read_from(BufReader::new(file)).unwrap();
/// ```
Attempt to read an Atom feed from the reader.
Attempt to read an Atom feed from the reader .
pub fn read_from<B: BufRead>(reader: B) -> Result<Feed, Error> {
        let mut reader = Reader::from_reader(reader);
        reader.expand_empty_elements(true);
        let mut buf = Vec::new();
        loop {
            match reader.read_event(&mut buf)? {
                Event::Start(element) => {
                    if element.name() == b"feed" {
                        let mut feed = Feed::from_xml(&mut reader, element.attributes())?;
                        for attr in element.attributes().with_checks(false) {
                            if let Ok(attr) = attr {
                                if !attr.key.starts_with(b"xmlns:") || attr.key == b"xmlns:dc" {
                                    continue;
                                }
                                let key = str::from_utf8(&attr.key[6..])?.to_string();
                                let value = attr.unescape_and_decode_value(&reader)?;
                                feed.namespaces.insert(key, value);
                            }
                        }
                        return Ok(feed);
                    } else {
                        return Err(Error::InvalidStartTag);
                    }
                }
                Event::Eof => break,
                _ => {}
            }
            buf.clear();
        }
        Err(Error::Eof)
    }
pub fn read_from < B : BufRead > ( reader : B ) -> Result < Feed , Error > { let mut reader = Reader :: from_reader ( reader ) ; reader . expand_empty_elements ( true ) ; let mut buf = Vec :: new ( ) ; loop { match reader . read_event ( & mut buf ) ? { Event :: Start ( element ) => { if element . name ( ) == b" " { let mut feed = Feed :: from_xml ( & mut reader , element . attributes ( ) ) ? ; for attr in element . attributes ( ) . with_checks ( false ) { if let Ok ( attr ) = attr { if ! attr . key . starts_with ( b" " ) || attr . key == b" " { continue ; } let key = str :: from_utf8 ( & attr . key [ 6 .. ] ) ? . to_string ( ) ; let value = attr . unescape_and_decode_value ( & reader ) ? ; feed . namespaces . insert ( key , value ) ; } } return Ok ( feed ) ; } else { return Err ( Error :: InvalidStartTag ) ; } } Event :: Eof => break , _ => { } } buf . clear ( ) ; } Err ( Error :: Eof ) }
Attempt to read an Atom feed from the reader.
Attempt to read an Atom feed from the reader .
reader
B
reader
B
examples
```no_run
use std::io::BufReader;
use std::fs::File;
use atom_syndication::Feed.

let file = File::open("example.xml").unwrap();
let feed = Feed::read_from(BufReader::new(file)).unwrap();
```
` ` ` no_run use std :: io :: BufReader ; use std :: fs :: File ; use atom_syndication :: Feed . let file = File :: open ( " example . xml " ) . unwrap () ; let feed = Feed :: read_from ( BufReader :: new ( file )) . unwrap () ; ` ` `