diff --git a/Cargo.lock b/Cargo.lock index d297240..8ae0154 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,26 +21,30 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "getrandom", + "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] -name = "base64ct" -version = "1.6.0" +name = "arbitrary" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "775a8770d29db3dadcb858482cc240af7b2ffde4ac4de67d1d4955728103f0e2" +dependencies = [ + "derive_arbitrary", +] [[package]] name = "bitflags" -version = "1.3.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -51,6 +55,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + [[package]] name = "byteorder" version = "1.5.0" @@ -107,9 +117,9 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "cpufeatures" @@ -120,6 +130,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32fast" version = "1.4.2" @@ -145,6 +170,12 @@ dependencies = [ "typenum", ] +[[package]] +name = "deflate64" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" + [[package]] name = "deranged" version = "0.3.11" @@ -154,6 +185,17 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derive_arbitrary" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d475dfebcb4854d596b17b09f477616f80f17a550517f2b3615d8c205d5c802b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "digest" version = "0.10.7" @@ -166,10 +208,27 @@ dependencies = [ ] [[package]] -name = "fallible-iterator" -version = "0.2.0" +name = "displaydoc" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fallible-streaming-iterator" @@ -210,20 +269,26 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", ] [[package]] -name = "hashlink" -version = "0.7.0" +name = "hashbrown" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" + +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] @@ -235,6 +300,16 @@ dependencies = [ "digest", ] +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.1", +] + [[package]] name = "inout" version = "0.1.3" @@ -261,15 +336,37 @@ checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libsqlite3-sys" -version = "0.24.2" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", "vcpkg", ] +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "lzma-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" +dependencies = [ + "byteorder", + "crc", +] + [[package]] name = "memchr" version = "2.7.4" @@ -297,17 +394,6 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - [[package]] name = "pbdbfixer" version = "0.8.3" @@ -319,14 +405,12 @@ dependencies = [ [[package]] name = "pbkdf2" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest", "hmac", - "password-hash", - "sha2", ] [[package]] @@ -341,6 +425,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + [[package]] name = "proc-macro2" version = "1.0.89" @@ -352,9 +445,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.23.1" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bafc859c6815fbaffbbbf4229ecb767ac913fecb27f9ad4343662e9ef099ea" +checksum = "ffbfb3ddf5364c9cfcd65549a1e7b801d0e8d1b14c1a1590a6408aa93cfbfa84" dependencies = [ "memchr", ] @@ -368,24 +461,47 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] [[package]] name = "rusqlite" -version = "0.27.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85127183a999f7db96d1a976a309eebbfb6ea3b0b400ddd8340190129de6eb7a" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" dependencies = [ "bitflags", "fallible-iterator", "fallible-streaming-iterator", "hashlink", "libsqlite3-sys", - "memchr", "smallvec", ] @@ -420,23 +536,18 @@ dependencies = [ "digest", ] -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "smallvec" version = "1.13.2" @@ -460,6 +571,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "thiserror" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02dd99dc800bbb97186339685293e1cc5d9df1f8fae2d0aecd9ff1c77efea892" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7c61ec9a6f64d2793d8a45faba21efbe3ced62a886d44c36a009b2b519b4c7e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "time" version = "0.3.36" @@ -510,41 +641,104 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "zip" -version = "0.6.6" +name = "zerocopy" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zip" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" dependencies = [ "aes", - "byteorder", + "arbitrary", "bzip2", "constant_time_eq", "crc32fast", "crossbeam-utils", + "deflate64", + "displaydoc", "flate2", "hmac", + "indexmap", + "lzma-rs", + "memchr", "pbkdf2", + "rand", "sha1", + "thiserror", "time", + "zeroize", + "zopfli", "zstd", ] [[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" +name = "zopfli" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", +] + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index de4df26..c94ace8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -zip = "0.6" -quick-xml = "0.23" +zip = "2.2.0" +quick-xml = "0.37" [dependencies.rusqlite] -version = "0.27" +version = "0.32.1" features = ["bundled"] diff --git a/src/epub.rs b/src/epub.rs index a5916d4..3574377 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -1,4 +1,5 @@ use std::{ + borrow::Borrow, collections::HashMap, fs::{self, File}, io::Read, @@ -52,17 +53,19 @@ fn get_rootfile(archive: &mut ZipArchive) -> String { container.read_to_string(&mut xml_str_buffer).unwrap(); let mut reader = Reader::from_str(&xml_str_buffer); - reader.trim_text(true); + reader.config_mut().trim_text(true); let mut buf = Vec::new(); let mut opf_filename = String::new(); loop { - match reader.read_event(&mut buf) { - Ok(Event::Start(ref e)) | Ok(Event::Empty(ref e)) if e.local_name() == b"rootfile" => { + match reader.read_event_into(&mut buf) { + Ok(Event::Start(ref e)) | Ok(Event::Empty(ref e)) + if e.local_name().into_inner() == b"rootfile" => + { opf_filename = String::from_utf8( e.attributes() - .filter(|attr| attr.as_ref().unwrap().key == b"full-path") + .filter(|attr| attr.as_ref().unwrap().key.into_inner() == b"full-path") .next() .unwrap() .unwrap() @@ -128,22 +131,22 @@ pub fn get_epub_metadata(filename: &str) -> Option { let mut xml_authors = HashMap::new(); loop { - match reader.read_event(&mut buf) { + match reader.read_event_into(&mut buf) { // See if we have EPUB3 or EPUB2 - Ok(Event::Start(ref e)) if e.local_name() == b"package" => { + Ok(Event::Start(ref e)) if e.local_name().into_inner() == b"package" => { if e.attributes().any(|attr| { - attr.as_ref().unwrap().key == b"version" + attr.as_ref().unwrap().key.into_inner() == b"version" && attr.as_ref().unwrap().value.starts_with(b"3") }) { is_epub3 = true; } } - Ok(Event::Start(ref e)) if e.local_name() == b"creator" => { + Ok(Event::Start(ref e)) if e.local_name().into_inner() == b"creator" => { creator_found = true; if is_epub3 { if let Some(idval) = e .attributes() - .filter(|attr| attr.as_ref().unwrap().key == b"id") + .filter(|attr| attr.as_ref().unwrap().key.into_inner() == b"id") .next() { curr_id = "#".to_string() @@ -159,19 +162,26 @@ pub fn get_epub_metadata(filename: &str) -> Option { } else { if let Some(file_as_val) = e .attributes() - .filter(|attr| attr.as_ref().unwrap().key.ends_with(b"file-as")) + .filter(|attr| { + attr.as_ref() + .unwrap() + .key + .into_inner() + .ends_with(b"file-as") + }) .next() { curr_id = "none".to_string() + xml_authors.len().to_string().as_str(); let entry = xml_authors.entry(curr_id.clone()).or_insert(XmlAut::new()); entry.sort = file_as_val .unwrap() - .unescape_and_decode_value(&reader) - .unwrap_or_default(); + .decode_and_unescape_value(*reader.decoder().borrow()) + .unwrap_or_default() + .to_string(); entry.role = "aut".to_string(); } else if let Some(_role_val) = e .attributes() - .filter(|attr| attr.as_ref().unwrap().key.ends_with(b"role")) + .filter(|attr| attr.as_ref().unwrap().key.into_inner().ends_with(b"role")) .next() { curr_id = "none".to_string() + xml_authors.len().to_string().as_str(); @@ -190,33 +200,33 @@ pub fn get_epub_metadata(filename: &str) -> Option { creator_found = false; } - Ok(Event::Start(ref e)) if e.local_name() == b"meta" && is_epub3 => { + Ok(Event::Start(ref e)) if e.local_name().into_inner() == b"meta" && is_epub3 => { if let Some(refines) = e .attributes() - .filter(|attr| attr.as_ref().unwrap().key == b"refines") + .filter(|attr| attr.as_ref().unwrap().key.into_inner() == b"refines") .next() { if e.attributes().any(|attr| { - attr.as_ref().unwrap().key == b"property" + attr.as_ref().unwrap().key.into_inner() == b"property" && attr.as_ref().unwrap().value.ends_with(b"file-as") }) { curr_id = String::from_utf8(refines.unwrap().value.to_vec()).unwrap(); file_as_found = true; } else if e.attributes().any(|attr| { - attr.as_ref().unwrap().key == b"property" + attr.as_ref().unwrap().key.into_inner() == b"property" && attr.as_ref().unwrap().value.ends_with(b"role") }) { curr_id = String::from_utf8(refines.unwrap().value.to_vec()).unwrap(); role_found = true; } else if e.attributes().any(|attr| { - attr.as_ref().unwrap().key == b"property" + attr.as_ref().unwrap().key.into_inner() == b"property" && attr.as_ref().unwrap().value.ends_with(b"group-position") }) { series_index_found = true; } } if e.attributes().any(|attr| { - attr.as_ref().unwrap().key == b"property" + attr.as_ref().unwrap().key.into_inner() == b"property" && attr .as_ref() .unwrap() @@ -226,40 +236,41 @@ pub fn get_epub_metadata(filename: &str) -> Option { series_found = true; } } - Ok(Event::Empty(ref e)) if e.local_name() == b"meta" && !is_epub3 => { + Ok(Event::Empty(ref e)) if e.local_name().into_inner() == b"meta" && !is_epub3 => { if e.attributes().any(|attr| { - attr.as_ref().unwrap().key == b"name" + attr.as_ref().unwrap().key.into_inner() == b"name" && attr .as_ref() .unwrap() - .unescaped_value() + .unescape_value() .unwrap() - .ends_with(b"series") + .ends_with("series") }) { epub_meta.series.name = e .attributes() - .filter(|attr| attr.as_ref().unwrap().key == b"content") + .filter(|attr| attr.as_ref().unwrap().key.into_inner() == b"content") .next() .unwrap() .unwrap() - .unescape_and_decode_value(&reader) - .unwrap_or_default(); + .decode_and_unescape_value(*reader.decoder().borrow()) + .unwrap_or_default() + .to_string(); } else if e.attributes().any(|attr| { - attr.as_ref().unwrap().key == b"name" + attr.as_ref().unwrap().key.into_inner() == b"name" && attr .as_ref() .unwrap() - .unescaped_value() + .unescape_value() .unwrap() - .ends_with(b"series_index") + .ends_with("series_index") }) { let index_float = e .attributes() - .filter(|attr| attr.as_ref().unwrap().key == b"content") + .filter(|attr| attr.as_ref().unwrap().key.into_inner() == b"content") .next() .unwrap() .unwrap() - .unescape_and_decode_value(&reader) + .decode_and_unescape_value(*reader.decoder().borrow()) .unwrap_or_default() .parse::() .unwrap_or_default(); @@ -291,11 +302,12 @@ pub fn get_epub_metadata(filename: &str) -> Option { series_index_found = false; } - Ok(Event::Start(ref e)) if e.local_name() == b"subject" => { + Ok(Event::Start(ref e)) if e.local_name().into_inner() == b"subject" => { genre_found = true; } Ok(Event::Text(ref e)) if genre_found => { - epub_meta.genre = e.unescape_and_decode(&reader).unwrap(); + //epub_meta.genre = e.unescape_and_decode(&reader).unwrap(); + epub_meta.genre = e.unescape().unwrap().to_string(); genre_found = false; } Ok(Event::Eof) => break,