Skip to content

Commit ca1c158

Browse files
committed
refactor: seal marker, smooth, scan_trial to pub(crate)
The #[doc(hidden)] pub mod hatch in lib.rs exposes 19 internal modules to external callers who can reach them via mozjpeg_rs::foo::bar despite the docs.rs hiding. That's intentional for modules like dct, consts, trellis, quant, huffman, progressive — internal benches/examples/tests and the sibling zenjpeg crate all import from them. But three modules have zero external reach in benches, examples, tests, or the sibling zenjpeg tree: - marker (JPEG marker writer, 756 LOC) - smooth (input smoothing filter, 227 LOC) - scan_trial (sequential scan trial encoder, 443 LOC) Seal those three to pub(crate) so they can't drift into the hidden API surface. Keeps the #[allow(dead_code)] attribute on each — sealing exposed some pre-existing dead code (MarkerWriter methods, scan_trial bookkeeping fields) that's a separate cleanup concern. Also delete MarkerWriter::get_ref — the one dead item with no callers anywhere in the crate, found while chasing the sealing warnings. types is NOT sealed in this commit: it exposes several pub items (ColorSpace, CompressionProfile, DctMethod, ScanInfo, ComponentInfo, QuantTable, HuffmanTable, DctBlock, SampleBlock, FloatBlock) that are not re-exported at the crate root, so sealing could theoretically break an external user reaching them via mozjpeg_rs::types::X. Left for a follow-up that also triages the extra items. cargo test --lib: 292 passed.
1 parent 90a992d commit ca1c158

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,8 @@ pub mod fast_entropy;
179179
pub mod huffman;
180180

181181
/// JPEG marker writing (internal).
182-
#[doc(hidden)]
183182
#[allow(dead_code)]
184-
pub mod marker;
183+
pub(crate) mod marker;
185184

186185
/// Progressive scan generation (internal).
187186
#[doc(hidden)]
@@ -199,19 +198,17 @@ pub mod quant;
199198
pub mod sample;
200199

201200
/// Input smoothing filter (internal).
202-
#[doc(hidden)]
203201
#[allow(dead_code)]
204-
pub mod smooth;
202+
pub(crate) mod smooth;
205203

206204
/// Scan optimization (internal).
207205
#[doc(hidden)]
208206
#[allow(dead_code)]
209207
pub mod scan_optimize;
210208

211209
/// Sequential scan trial encoding (internal).
212-
#[doc(hidden)]
213210
#[allow(dead_code)]
214-
pub mod scan_trial;
211+
pub(crate) mod scan_trial;
215212

216213
/// SIMD acceleration (internal).
217214
#[doc(hidden)]

src/marker.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,6 @@ impl<W: Write> MarkerWriter<W> {
436436
self.output
437437
}
438438

439-
/// Get a reference to the underlying output.
440-
pub fn get_ref(&self) -> &W {
441-
&self.output
442-
}
443-
444439
/// Get a mutable reference to the underlying output.
445440
pub fn get_mut(&mut self) -> &mut W {
446441
&mut self.output

0 commit comments

Comments
 (0)