#[cfg(feature = "vfs04")] mod vfs04;
use crate::Result;
use std::collections::*;
use std::fmt::{self, Debug, Formatter};
use std::io::{Write, Seek};
use std::sync::{Arc, Mutex};
pub struct ZipWriteOnly<IO: Write + Seek + Send + 'static> {
imp: Arc<Mutex<Imp<IO>>>,
weak: bool,
}
struct Imp<IO: Write + Seek + Send + 'static> {
writer: zip::write::ZipWriter<IO>,
dirs: BTreeSet<String>,
}
impl<IO: Write + Seek + Send> Debug for ZipWriteOnly<IO> {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
write!(fmt, "ZipWriteOnly")
}
}
impl<IO: Write + Seek + Send> ZipWriteOnly<IO> {
pub fn new_strong(io: IO) -> Result<Self> { Self::new_impl(io, false) }
pub fn new_weak(io: IO) -> Result<Self> { Self::new_impl(io, true) }
fn new_impl(io: IO, weak: bool) -> Result<Self> {
Ok(Self {
imp: Arc::new(Mutex::new(Imp {
writer: zip::write::ZipWriter::new(io),
dirs: Default::default(),
})),
weak,
})
}
}