pub enum Entry<'a> {
File(FileEntry<'a>),
Directory(DirEntry<'a>),
Symlink(SymlinkEntry<'a>),
}Expand description
An entry in the archive of any type.
This enum provides generic access to archive entries when the caller
needs to handle any entry type. For type-specific access, use
[ArchiveRead::file], [ArchiveRead::folder], or the entry’s
conversion methods.
§Example
match archive.entry("some/path")? {
Entry::File(f) => println!("file: {} bytes", f.size()),
Entry::Directory(d) => println!("dir: {}", d.path()),
Entry::Symlink(s) => println!("link -> {}", s.target().unwrap_or("<binary>")),
}Variants§
File(FileEntry<'a>)
A regular file entry.
Directory(DirEntry<'a>)
A directory entry.
Symlink(SymlinkEntry<'a>)
A symbolic link entry.
Implementations§
Source§impl<'a> Entry<'a>
impl<'a> Entry<'a>
Sourcepub fn is_directory(&self) -> bool
pub fn is_directory(&self) -> bool
Returns true if this is a directory entry.
Sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Returns true if this is a symlink entry.
Sourcepub fn as_file(&self) -> Option<&FileEntry<'a>>
pub fn as_file(&self) -> Option<&FileEntry<'a>>
Returns the file entry if this is a file, or None otherwise.
Sourcepub fn as_directory(&self) -> Option<&DirEntry<'a>>
pub fn as_directory(&self) -> Option<&DirEntry<'a>>
Returns the directory entry if this is a directory, or None otherwise.
Sourcepub fn as_symlink(&self) -> Option<&SymlinkEntry<'a>>
pub fn as_symlink(&self) -> Option<&SymlinkEntry<'a>>
Returns the symlink entry if this is a symlink, or None otherwise.
Sourcepub fn into_file(self) -> Option<FileEntry<'a>>
pub fn into_file(self) -> Option<FileEntry<'a>>
Converts into a file entry if this is a file, or None otherwise.
Sourcepub fn into_directory(self) -> Option<DirEntry<'a>>
pub fn into_directory(self) -> Option<DirEntry<'a>>
Converts into a directory entry if this is a directory, or None otherwise.
Sourcepub fn into_symlink(self) -> Option<SymlinkEntry<'a>>
pub fn into_symlink(self) -> Option<SymlinkEntry<'a>>
Converts into a symlink entry if this is a symlink, or None otherwise.