Implement Display trait for CompressionMethod.
It's an alias to the Debug format, but we can't derive Display yet, so we associate it explicitly.
This commit is contained in:
parent
b1f7a49337
commit
a63b7315d0
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
//! Possible ZIP compression methods.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
/// Compression methods for the contents of a ZIP file.
|
||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||
pub enum CompressionMethod
|
||||
|
@ -39,6 +41,13 @@ impl CompressionMethod {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for CompressionMethod {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
// Just duplicate what the Debug format looks like, i.e, the enum key:
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::CompressionMethod;
|
||||
|
|
Loading…
Add table
Reference in a new issue