aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/mod.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-27 17:02:11 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-27 17:02:11 -0600
commit86c271eb2f9c0b3e1e2a35d26a2dca37435b5b8c (patch)
tree5adc564056cf349793f4b9ffd6c70bf908117cc1 /src/makefile/mod.rs
parent5197d769bb2fea50975122a4ebba89c07c712839 (diff)
downloadmakers-86c271eb2f9c0b3e1e2a35d26a2dca37435b5b8c.tar.gz
makers-86c271eb2f9c0b3e1e2a35d26a2dca37435b5b8c.zip
why `pub` when you can `pub(crate)`?
Diffstat (limited to 'src/makefile/mod.rs')
-rw-r--r--src/makefile/mod.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs
index 1ce335d..23243e4 100644
--- a/src/makefile/mod.rs
+++ b/src/makefile/mod.rs
@@ -29,17 +29,17 @@ enum MacroSource {
Builtin,
}
-pub struct Makefile<'a> {
+pub(crate) struct Makefile<'a> {
inference_rules: Vec<InferenceRule>,
macros: HashMap<String, (MacroSource, TokenString)>,
targets: RefCell<HashMap<String, Rc<RefCell<Target>>>>,
- pub first_non_special_target: Option<String>,
+ pub(crate) first_non_special_target: Option<String>,
args: &'a Args,
// TODO borrow warnings from Python version
}
impl<'a> Makefile<'a> {
- pub fn new(args: &'a Args) -> Self {
+ pub(crate) fn new(args: &'a Args) -> Self {
let mut inference_rules = vec![];
let mut macros = HashMap::new();
let mut targets = HashMap::new();
@@ -84,7 +84,7 @@ impl<'a> Makefile<'a> {
}
}
- pub fn and_read_file(&mut self, path: impl AsRef<Path>) {
+ pub(crate) fn and_read_file(&mut self, path: impl AsRef<Path>) {
let file = File::open(path);
// TODO handle errors
let file = file.expect("couldn't open makefile!");
@@ -92,7 +92,7 @@ impl<'a> Makefile<'a> {
self.and_read(file_reader);
}
- pub fn and_read(&mut self, source: impl BufRead) {
+ pub(crate) fn and_read(&mut self, source: impl BufRead) {
let mut lines_iter = source.lines().enumerate().peekable();
while let Some((line_number, line)) = lines_iter.next() {
// TODO handle I/O errors at all
@@ -369,7 +369,7 @@ impl<'a> Makefile<'a> {
}
}
- pub fn get_target(&self, name: &str) -> Rc<RefCell<Target>> {
+ pub(crate) fn get_target(&self, name: &str) -> Rc<RefCell<Target>> {
// TODO implement .POSIX
let follow_gnu = true;
@@ -467,7 +467,7 @@ impl<'a> Makefile<'a> {
targets.get(name).expect("Target not found!").clone()
}
- pub fn update_target(&self, name: &str) {
+ pub(crate) fn update_target(&self, name: &str) {
self.get_target(name).borrow().update(self);
}