You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you think it makes sense to include this work in your library, or is it better to publish it as a forked crate? It will obviously need some more work (support for extensions, user settings set_ignore_zeros etc).
The following is now possible:
let input = File::open("tests/archives/reading_files.tar").unwrap();letmut entries = Archive::new(input).into_entries();// test 1: move the entry into a scoped thread{letmut a = entries.next().expect("expected entry a present").unwrap();
thread::scope(|s| {
s.spawn(|| {assert_eq!(&*a.header.path_bytes(),b"a");letmut s = String::new();
a.read_to_string(&mut s).unwrap();assert_eq!(s,"a\na\na\na\na\na\na\na\na\na\na\n");});});}// test 2: move the entries iterator to a new thread
thread::scope(|s| {
s.spawn(|| {letmut b = entries.next().expect("expected entry b present").unwrap();assert_eq!(&*b.header.path_bytes(),b"b");letmut s = String::new();
b.read_to_string(&mut s).unwrap();assert_eq!(s,"b\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\n");});});
Also, because the entries mutably borrow the SimpleEntries object, it is impossible to consume the entries out of order.
Curious to hear what you think!
The text was updated successfully, but these errors were encountered:
For a niche use-case I found myself in need of a tar entries iterator that was
Send + 'static
.I wrote a proof of concept for
Archive::into_entries()
at main...orottier:tar-rs:masterDo you think it makes sense to include this work in your library, or is it better to publish it as a forked crate? It will obviously need some more work (support for extensions, user settings
set_ignore_zeros
etc).The following is now possible:
Also, because the entries mutably borrow the
SimpleEntries
object, it is impossible to consume the entries out of order.Curious to hear what you think!
The text was updated successfully, but these errors were encountered: