From cc13a23b076ec10fbe3c07a6a7d5955c3d1021c0 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Thu, 9 Jun 2022 12:58:39 +1000 Subject: [PATCH] Mark all internal types & fn as `pub(crate)` Signed-off-by: Jiahao XU --- src/helpers/async_file_writer.rs | 2 +- src/helpers/extracter.rs | 4 ++-- src/helpers/readable_rx.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/helpers/async_file_writer.rs b/src/helpers/async_file_writer.rs index eacb20bf..ab90f8a3 100644 --- a/src/helpers/async_file_writer.rs +++ b/src/helpers/async_file_writer.rs @@ -10,7 +10,7 @@ use tokio::{sync::mpsc, task::spawn_blocking}; use super::{extracter::*, readable_rx::*, AutoAbortJoinHandle}; use crate::{BinstallError, PkgFmt}; -pub enum Content { +pub(crate) enum Content { /// Data to write to file Data(Bytes), diff --git a/src/helpers/extracter.rs b/src/helpers/extracter.rs index 77ad3665..c851b0c8 100644 --- a/src/helpers/extracter.rs +++ b/src/helpers/extracter.rs @@ -14,7 +14,7 @@ use crate::{BinstallError, PkgFmt}; /// Extract files from the specified source onto the specified path. /// /// * `fmt` - must not be `PkgFmt::Bin` or `PkgFmt::Zip`. -pub fn extract_compressed_from_readable( +pub(crate) fn extract_compressed_from_readable( dat: impl Read, fmt: PkgFmt, path: &Path, @@ -66,7 +66,7 @@ pub fn extract_compressed_from_readable( Ok(()) } -pub fn unzip(dat: File, dst: &Path) -> Result<(), BinstallError> { +pub(crate) fn unzip(dat: File, dst: &Path) -> Result<(), BinstallError> { debug!("Decompressing from zip archive to `{dst:?}`"); let mut zip = ZipArchive::new(dat)?; diff --git a/src/helpers/readable_rx.rs b/src/helpers/readable_rx.rs index 02ccc344..8b387ab6 100644 --- a/src/helpers/readable_rx.rs +++ b/src/helpers/readable_rx.rs @@ -7,13 +7,13 @@ use tokio::sync::mpsc::Receiver; use super::async_file_writer::Content; #[derive(Debug)] -pub struct ReadableRx<'a> { +pub(crate) struct ReadableRx<'a> { rx: &'a mut Receiver, bytes: Bytes, } impl<'a> ReadableRx<'a> { - pub fn new(rx: &'a mut Receiver) -> Self { + pub(crate) fn new(rx: &'a mut Receiver) -> Self { Self { rx, bytes: Bytes::new(),