aboutsummaryrefslogtreecommitdiffstats
path: root/src/archive.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2025-01-03 18:05:18 +0000
committerGitHub <noreply@github.com>2025-01-03 18:05:18 +0000
commit36e15b259eb9ee7fc0fdff0acb12d9adc889887c (patch)
treeb4affed9c0f82ba4a846e7d9d15bc7f130523401 /src/archive.rs
parentMerge pull request #1463 from svenstaro/dependabot/cargo/all-dependencies-435... (diff)
parentUse Self where possible (diff)
downloadminiserve-36e15b259eb9ee7fc0fdff0acb12d9adc889887c.tar.gz
miniserve-36e15b259eb9ee7fc0fdff0acb12d9adc889887c.zip
Merge pull request #1466 from adamnemecek/master
Use Self where possible.
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),
}
}
}