From 73cff04eb5c757de64553eca95f4eea92796c54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20M=2E=20Bezerra?= Date: Tue, 10 Jan 2023 04:35:24 -0300 Subject: [PATCH] make some extension items private --- src/extension.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/extension.rs b/src/extension.rs index 257e206..a4166af 100644 --- a/src/extension.rs +++ b/src/extension.rs @@ -14,8 +14,9 @@ pub struct Extension { /// One extension like "tgz" can be made of multiple CompressionFormats ([Tar, Gz]) pub compression_formats: &'static [CompressionFormat], /// The input text for this extension, like "tgz", "tar" or "xz" - pub display_text: String, + display_text: String, } + // The display_text should be ignored when comparing extensions impl PartialEq for Extension { fn eq(&self, other: &Self) -> bool { @@ -70,7 +71,7 @@ pub enum CompressionFormat { impl CompressionFormat { /// Currently supported archive formats are .tar (and aliases to it) and .zip - pub fn is_archive_format(&self) -> bool { + fn is_archive_format(&self) -> bool { // Keep this match like that without a wildcard `_` so we don't forget to update it match self { Tar | Zip => true, @@ -89,7 +90,7 @@ pub const SUPPORTED_EXTENSIONS: &[&str] = &[ "zst", ]; -pub fn to_extension(ext: &[u8]) -> Option { +fn to_extension(ext: &[u8]) -> Option { Some(Extension::new( match ext { b"tar" => &[Tar], @@ -112,7 +113,7 @@ pub fn to_extension(ext: &[u8]) -> Option { )) } -pub fn split_extension<'a>(name: &mut &'a [u8]) -> Option<&'a [u8]> { +fn split_extension<'a>(name: &mut &'a [u8]) -> Option<&'a [u8]> { let (new_name, ext) = name.rsplit_once_str(b".")?; if matches!(new_name, b"" | b"." | b"..") { return None;