Skip to main content

ZipDirArchive

Struct ZipDirArchive 

Source
pub struct ZipDirArchive<R: Read + Seek> { /* private fields */ }
Expand description

Read-access to either a single zip file or an directory.

This provides a uniform API for accessing files in a directory in a conventional filesystem or accessing entries in a zip archive. See the crate-level documentation for more information.

Implementations§

Source§

impl ZipDirArchive<BufReader<File>>

Source

pub fn auto_from_path<P: AsRef<Path>>(path: P) -> Result<Self>

Automatically open a path on the filesystem as a ZipDirArchive

If the path is a directory, it will be opened with Self::from_dir. If not, it will be opened as a file and passed to Self::from_zip.

Source

pub fn from_dir(path: PathBuf) -> Result<Self>

Open a filesystem directory as a ZipDirArchive.

Source§

impl<R: Read + Seek> ZipDirArchive<R>

Source

pub fn from_zip(reader: R, display_name: String) -> Result<Self>

Open a reader of a zip archive as a ZipDirArchive.

Source

pub fn path_starter(&mut self) -> PathLike<'_, R>

Source

pub fn display(&self) -> Display<'_>

Source

pub fn path(&self) -> &Path

Source

pub fn exists(&mut self, relname: &Path) -> bool

Source

pub fn open<P: AsRef<Path>>(&mut self, relname: P) -> Result<FileReader<'_>>

Open relative path and return reader.

Source

pub fn is_file<P: AsRef<Path>>(&mut self, relname: P) -> bool

Source

pub fn list_paths<P: AsRef<Path> + Debug>( &self, relname: Option<P>, ) -> Result<Vec<PathBuf>>

Lists, non-recursively, the paths in this directory.

Note that on Windows, the result paths will have backslashes even though the zip file itself will have paths with forward slashes.

Source

pub fn open_raw_or_gz(&mut self, src_fname: &str) -> Result<MaybeGzReader<'_>>

Open raw file (e.g. .csv) or gz version (e.g. .csv.gz) of a file.

This prefers to use the gz compressed file if it exists.

Trait Implementations§

Source§

impl<R: Read + Seek> Debug for ZipDirArchive<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for ZipDirArchive<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for ZipDirArchive<R>
where R: RefUnwindSafe,

§

impl<R> Send for ZipDirArchive<R>
where R: Send,

§

impl<R> Sync for ZipDirArchive<R>
where R: Sync,

§

impl<R> Unpin for ZipDirArchive<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for ZipDirArchive<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for ZipDirArchive<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.