Enum ZipError

#[non_exhaustive]
pub enum ZipError

Error type for Zip

Variants

Io(Error)

i/o error

InvalidArchive(Cow<'static, str>)

invalid Zip archive

UnsupportedArchive(&'static str)

unsupported Zip archive

FileNotFound

specified file not found in archive

InvalidPassword

provided password is incorrect

CompressionMethodNotSupported(u16)

Compression method not supported

Implementations

impl ZipError

const PASSWORD_REQUIRED: &'static str = "Password required to decrypt file";

The text used as an error when a password is required and not supplied

# use zip::result::ZipError;
# let mut archive = zip::ZipArchive::new(std::io::Cursor::new(&[])).unwrap();
match archive.by_index(1) {
    Err(ZipError::UnsupportedArchive(ZipError::PASSWORD_REQUIRED)) => eprintln!("a password is needed to unzip this file"),
    _ => (),
}
# ()

Trait Implementations

impl Debug for ZipError

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

impl Display for ZipError

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

impl Error for ZipError

fn source(&self) -> Option<&dyn Error + 'static>

impl From<DateTimeRangeError> for ZipError

fn from(DateTimeRangeError) -> Self

impl From<Error> for ZipError

fn from(value: Error) -> Self

impl From<FromUtf8Error> for ZipError

fn from(FromUtf8Error) -> Self

Auto Trait Implementations

impl !RefUnwindSafe for ZipError

impl !UnwindSafe for ZipError

impl Freeze for ZipError

impl Send for ZipError

impl Sync for ZipError

impl Unpin for ZipError

impl UnsafeUnpin for ZipError

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for ZipError

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Same for ZipError

type Output = T;

impl<T> ToString for ZipError where T: Display + ?Sized,

fn to_string(&self) -> String

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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