@@ -73,7 +73,7 @@ impl Components {
73
73
} )
74
74
. collect ( ) )
75
75
}
76
- pub fn add < ' a > ( & self , name : & str , tx : Transaction < ' a > ) -> ComponentBuilder < ' a > {
76
+ pub ( crate ) fn add < ' a > ( & self , name : & str , tx : Transaction < ' a > ) -> ComponentBuilder < ' a > {
77
77
ComponentBuilder {
78
78
components : self . clone ( ) ,
79
79
name : name. to_owned ( ) ,
@@ -85,40 +85,40 @@ impl Components {
85
85
let result = self . list ( ) ?;
86
86
Ok ( result. into_iter ( ) . find ( |c| ( c. name ( ) == name) ) )
87
87
}
88
- pub fn prefix ( & self ) -> InstallPrefix {
88
+ pub ( crate ) fn prefix ( & self ) -> InstallPrefix {
89
89
self . prefix . clone ( )
90
90
}
91
91
}
92
92
93
- pub struct ComponentBuilder < ' a > {
93
+ pub ( crate ) struct ComponentBuilder < ' a > {
94
94
components : Components ,
95
95
name : String ,
96
96
parts : Vec < ComponentPart > ,
97
97
tx : Transaction < ' a > ,
98
98
}
99
99
100
100
impl < ' a > ComponentBuilder < ' a > {
101
- pub fn copy_file ( & mut self , path : PathBuf , src : & Path ) -> Result < ( ) > {
101
+ pub ( crate ) fn copy_file ( & mut self , path : PathBuf , src : & Path ) -> Result < ( ) > {
102
102
self . parts
103
103
. push ( ComponentPart ( "file" . to_owned ( ) , path. clone ( ) ) ) ;
104
104
self . tx . copy_file ( & self . name , path, src)
105
105
}
106
- pub fn copy_dir ( & mut self , path : PathBuf , src : & Path ) -> Result < ( ) > {
106
+ pub ( crate ) fn copy_dir ( & mut self , path : PathBuf , src : & Path ) -> Result < ( ) > {
107
107
self . parts
108
108
. push ( ComponentPart ( "dir" . to_owned ( ) , path. clone ( ) ) ) ;
109
109
self . tx . copy_dir ( & self . name , path, src)
110
110
}
111
- pub fn move_file ( & mut self , path : PathBuf , src : & Path ) -> Result < ( ) > {
111
+ pub ( crate ) fn move_file ( & mut self , path : PathBuf , src : & Path ) -> Result < ( ) > {
112
112
self . parts
113
113
. push ( ComponentPart ( "file" . to_owned ( ) , path. clone ( ) ) ) ;
114
114
self . tx . move_file ( & self . name , path, src)
115
115
}
116
- pub fn move_dir ( & mut self , path : PathBuf , src : & Path ) -> Result < ( ) > {
116
+ pub ( crate ) fn move_dir ( & mut self , path : PathBuf , src : & Path ) -> Result < ( ) > {
117
117
self . parts
118
118
. push ( ComponentPart ( "dir" . to_owned ( ) , path. clone ( ) ) ) ;
119
119
self . tx . move_dir ( & self . name , path, src)
120
120
}
121
- pub fn finish ( mut self ) -> Result < Transaction < ' a > > {
121
+ pub ( crate ) fn finish ( mut self ) -> Result < Transaction < ' a > > {
122
122
// Write component manifest
123
123
let path = self . components . rel_component_manifest ( & self . name ) ;
124
124
let abs_path = self . components . prefix . abs_path ( & path) ;
@@ -146,10 +146,10 @@ impl<'a> ComponentBuilder<'a> {
146
146
pub struct ComponentPart ( pub String , pub PathBuf ) ;
147
147
148
148
impl ComponentPart {
149
- pub fn encode ( & self ) -> String {
149
+ pub ( crate ) fn encode ( & self ) -> String {
150
150
format ! ( "{}:{}" , & self . 0 , & self . 1 . to_string_lossy( ) )
151
151
}
152
- pub fn decode ( line : & str ) -> Option < Self > {
152
+ pub ( crate ) fn decode ( line : & str ) -> Option < Self > {
153
153
line. find ( ':' )
154
154
. map ( |pos| Self ( line[ 0 ..pos] . to_owned ( ) , PathBuf :: from ( & line[ ( pos + 1 ) ..] ) ) )
155
155
}
@@ -162,21 +162,21 @@ pub struct Component {
162
162
}
163
163
164
164
impl Component {
165
- pub fn manifest_name ( & self ) -> String {
165
+ pub ( crate ) fn manifest_name ( & self ) -> String {
166
166
format ! ( "manifest-{}" , & self . name)
167
167
}
168
- pub fn manifest_file ( & self ) -> PathBuf {
168
+ pub ( crate ) fn manifest_file ( & self ) -> PathBuf {
169
169
self . components . prefix . manifest_file ( & self . manifest_name ( ) )
170
170
}
171
- pub fn rel_manifest_file ( & self ) -> PathBuf {
171
+ pub ( crate ) fn rel_manifest_file ( & self ) -> PathBuf {
172
172
self . components
173
173
. prefix
174
174
. rel_manifest_file ( & self . manifest_name ( ) )
175
175
}
176
- pub fn name ( & self ) -> & str {
176
+ pub ( crate ) fn name ( & self ) -> & str {
177
177
& self . name
178
178
}
179
- pub fn parts ( & self ) -> Result < Vec < ComponentPart > > {
179
+ pub ( crate ) fn parts ( & self ) -> Result < Vec < ComponentPart > > {
180
180
let mut result = Vec :: new ( ) ;
181
181
for line in utils:: read_file ( "component" , & self . manifest_file ( ) ) ?. lines ( ) {
182
182
result. push (
0 commit comments