epub 2.1.5

Library to support the reading of epub files.
Documentation
use epub::doc::EpubDoc;

#[test]
fn read_doc() {
    let input_file = "tests/docs/Metamorphosis-jackson.epub";
    let doc = EpubDoc::new(input_file);
    assert!(doc.is_ok());
    let mut doc = doc.unwrap();

    if let Some(title) = doc.get_title() {
        println!("Book title: {}", title);
    } else {
        println!("Book title not found");
    }
    println!("Num Pages: {}\n", doc.get_num_chapters());

    {
        println!("resources:\n");
        for (k, v) in doc.resources.iter() {
            println!("{}: {}\n * {}\n", k, v.mime, v.path.display());
        }
        println!();
    }

    while doc.go_next() {
        println!("ID: {}", doc.get_current_id().unwrap());
        let current = doc.get_current_str();
        match current {
            Some((v, m)) => println!("Value {:?}, Mime {:?}\n", v, m),
            None => println!("Not Found\n"),
        }
    }
}

#[test]
fn bad_epub() {
    //book2.epub has a opf encoded in UTF-16
    //It also has malformed toc, manifest and guide entries, as well as multiple metadata entries
    let input_file = "tests/docs/book2.epub";
    let doc = EpubDoc::new(input_file);
    assert!(doc.is_ok());
    let doc = doc.unwrap();
    let titles: Vec<String> = doc
        .metadata
        .iter()
        .filter_map(|d| {
            if d.property == "title" {
                Some(d.value.clone())
            } else {
                None
            }
        })
        .collect();
    if !titles.is_empty() {
        assert_eq!(
            titles,
            vec!["Metamorphosis ".to_string(), "Metamorphosis2 ".to_string()]
        );
        println!("Book title: {:#?}", titles);
    } else {
        println!("Book title not found");
    }
}