aboutsummaryrefslogtreecommitdiffstats
path: root/src/archive.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2025-02-07 12:48:50 +0000
committerGitHub <noreply@github.com>2025-02-07 12:48:50 +0000
commit77b1c1cd0bfab5d4dc5e0994050fabd4a19cdd0f (patch)
tree0b9e157598d2361397ee09e7f196938d284c48f9 /src/archive.rs
parentchore: clean up (diff)
parentAdd CHANGELOG entry for #1473 (diff)
downloadminiserve-77b1c1cd0bfab5d4dc5e0994050fabd4a19cdd0f.tar.gz
miniserve-77b1c1cd0bfab5d4dc5e0994050fabd4a19cdd0f.zip
Merge branch 'master' into upload-progress-bar
Diffstat (limited to 'src/archive.rs')
-rw-r--r--src/archive.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/archive.rs b/src/archive.rs
index b8ba4d4..da79ef8 100644
--- a/src/archive.rs
+++ b/src/archive.rs
@@ -28,27 +28,27 @@ pub enum ArchiveMethod {
impl ArchiveMethod {
pub fn extension(self) -> String {
match self {
- ArchiveMethod::TarGz => "tar.gz",
- ArchiveMethod::Tar => "tar",
- ArchiveMethod::Zip => "zip",
+ Self::TarGz => "tar.gz",
+ Self::Tar => "tar",
+ Self::Zip => "zip",
}
.to_string()
}
pub fn content_type(self) -> String {
match self {
- ArchiveMethod::TarGz => "application/gzip",
- ArchiveMethod::Tar => "application/tar",
- ArchiveMethod::Zip => "application/zip",
+ Self::TarGz => "application/gzip",
+ Self::Tar => "application/tar",
+ Self::Zip => "application/zip",
}
.to_string()
}
pub fn is_enabled(self, tar_enabled: bool, tar_gz_enabled: bool, zip_enabled: bool) -> bool {
match self {
- ArchiveMethod::TarGz => tar_gz_enabled,
- ArchiveMethod::Tar => tar_enabled,
- ArchiveMethod::Zip => zip_enabled,
+ Self::TarGz => tar_gz_enabled,
+ Self::Tar => tar_enabled,
+ Self::Zip => zip_enabled,
}
}
@@ -69,9 +69,9 @@ impl ArchiveMethod {
{
let dir = dir.as_ref();
match self {
- ArchiveMethod::TarGz => tar_gz(dir, skip_symlinks, out),
- ArchiveMethod::Tar => tar_dir(dir, skip_symlinks, out),
- ArchiveMethod::Zip => zip_dir(dir, skip_symlinks, out),
+ Self::TarGz => tar_gz(dir, skip_symlinks, out),
+ Self::Tar => tar_dir(dir, skip_symlinks, out),
+ Self::Zip => zip_dir(dir, skip_symlinks, out),
}
}
}