Skip to content

Commit bbb6c4c

Browse files
committed
Make all currentprocess functions and structs crate-private
1 parent 44be718 commit bbb6c4c

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/currentprocess.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use std::sync::{Arc, Mutex};
1111

1212
use rand::{thread_rng, Rng};
1313

14-
pub mod argsource;
15-
pub mod cwdsource;
16-
pub mod filesource;
14+
pub(crate) mod argsource;
15+
pub(crate) mod cwdsource;
16+
pub(crate) mod filesource;
1717
mod homethunk;
18-
pub mod varsource;
18+
pub(crate) mod varsource;
1919

2020
use argsource::*;
2121
use cwdsource::*;
@@ -121,7 +121,7 @@ pub fn process() -> Box<dyn CurrentProcess> {
121121
}
122122

123123
/// Obtain the current instance of HomeProcess
124-
pub fn home_process() -> Box<dyn HomeProcess> {
124+
pub(crate) fn home_process() -> Box<dyn HomeProcess> {
125125
match PROCESS.with(|p| p.borrow().clone()) {
126126
None => panic!("No process instance"),
127127
Some(p) => p,
@@ -163,7 +163,7 @@ fn clear_process() {
163163
}
164164

165165
thread_local! {
166-
pub static PROCESS:RefCell<Option<Box<dyn HomeProcess>>> = RefCell::new(None);
166+
pub(crate) static PROCESS:RefCell<Option<Box<dyn HomeProcess>>> = RefCell::new(None);
167167
}
168168

169169
// PID related things
@@ -191,13 +191,13 @@ impl ProcessSource for OSProcess {
191191

192192
#[derive(Clone, Debug, Default)]
193193
pub struct TestProcess {
194-
pub cwd: PathBuf,
195-
pub args: Vec<String>,
196-
pub vars: HashMap<String, String>,
197-
pub id: u64,
198-
pub stdin: TestStdinInner,
199-
pub stdout: TestWriterInner,
200-
pub stderr: TestWriterInner,
194+
pub(crate) cwd: PathBuf,
195+
pub(crate) args: Vec<String>,
196+
pub(crate) vars: HashMap<String, String>,
197+
pub(crate) id: u64,
198+
pub(crate) stdin: TestStdinInner,
199+
pub(crate) stdout: TestWriterInner,
200+
pub(crate) stderr: TestWriterInner,
201201
}
202202

203203
impl TestProcess {

src/currentprocess/argsource.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl ArgSource for super::OSProcess {
2020
}
2121

2222
/// Helper for ArgSource over `Vec<String>`
23-
pub struct VecArgs<T> {
23+
pub(crate) struct VecArgs<T> {
2424
v: Vec<String>,
2525
i: usize,
2626
_marker: PhantomData<T>,

src/currentprocess/filesource.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl BufRead for TestStdinLock<'_> {
5858
}
5959
}
6060

61-
pub type TestStdinInner = Arc<Mutex<Cursor<String>>>;
61+
pub(crate) type TestStdinInner = Arc<Mutex<Cursor<String>>>;
6262

6363
struct TestStdin(TestStdinInner);
6464

@@ -165,7 +165,7 @@ impl Write for TestWriterLock<'_> {
165165
}
166166
}
167167

168-
pub type TestWriterInner = Arc<Mutex<Vec<u8>>>;
168+
pub(crate) type TestWriterInner = Arc<Mutex<Vec<u8>>>;
169169

170170
struct TestWriter(TestWriterInner);
171171

0 commit comments

Comments
 (0)