From 9285727e95cd5b909362ab58c2301c77547f0b99 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 2 May 2023 01:22:47 +1200 Subject: [PATCH] Restrict functions to pub(crate) where appropriate --- src/colors.rs | 6 +++--- src/filters.rs | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/colors.rs b/src/colors.rs index 59a0c360..22f24f19 100644 --- a/src/colors.rs +++ b/src/colors.rs @@ -56,7 +56,7 @@ impl ColorType { } #[inline] - pub fn channels_per_pixel(&self) -> u8 { + pub(crate) fn channels_per_pixel(&self) -> u8 { match self { ColorType::Grayscale { .. } | ColorType::Indexed { .. } => 1, ColorType::GrayscaleAlpha => 2, @@ -66,12 +66,12 @@ impl ColorType { } #[inline] - pub fn is_rgb(&self) -> bool { + pub(crate) fn is_rgb(&self) -> bool { matches!(self, ColorType::RGB { .. } | ColorType::RGBA) } #[inline] - pub fn has_alpha(&self) -> bool { + pub(crate) fn has_alpha(&self) -> bool { matches!(self, ColorType::GrayscaleAlpha | ColorType::RGBA) } diff --git a/src/filters.rs b/src/filters.rs index 1fec39e6..a2136139 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -53,10 +53,11 @@ impl Display for RowFilter { impl RowFilter { pub const LAST: u8 = Self::Brute as u8; - pub const STANDARD: [Self; 5] = [Self::None, Self::Sub, Self::Up, Self::Average, Self::Paeth]; - pub const SINGLE_LINE: [Self; 2] = [Self::None, Self::Sub]; + pub(crate) const STANDARD: [Self; 5] = + [Self::None, Self::Sub, Self::Up, Self::Average, Self::Paeth]; + pub(crate) const SINGLE_LINE: [Self; 2] = [Self::None, Self::Sub]; - pub fn filter_line( + pub(crate) fn filter_line( self, bpp: usize, data: &mut [u8], @@ -176,7 +177,7 @@ impl RowFilter { } } - pub fn unfilter_line( + pub(crate) fn unfilter_line( self, bpp: usize, data: &[u8],