1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- pub type! IOError {
15+ pub ( all ) type! IOError {
1616 NotFound (String )
1717}
1818
@@ -31,7 +31,7 @@ fn IOError::to_string(self : IOError) -> String {
3131/// # Parameters
3232/// - `path`: A `String` representing the file path.
3333/// - `content`: A `String` containing the content to be written to the file.
34- pub fn write_string_to_file (~ path : String , ~ content : String ) -> Unit {
34+ pub fn write_string_to_file (path ~ : String , content ~ : String ) -> Unit {
3535 @ffi .write_string_to_file (path , content )
3636}
3737
@@ -41,7 +41,7 @@ pub fn write_string_to_file(~path : String, ~content : String) -> Unit {
4141///
4242/// - `path` : The path to the file where the bytes will be written.
4343/// - `content` : An array of bytes to be written to the file.
44- pub fn write_bytes_to_file (~ path : String , ~ content : Bytes ) -> Unit {
44+ pub fn write_bytes_to_file (path ~ : String , content ~ : Bytes ) -> Unit {
4545 @ffi .write_bytes_to_file (path , content )
4646}
4747
@@ -52,7 +52,7 @@ pub fn write_bytes_to_file(~path : String, ~content : Bytes) -> Unit {
5252///
5353/// # Returns
5454/// A boolean indicating whether the path exists.
55- pub fn path_exists (~ path : String ) -> Bool {
55+ pub fn path_exists (path ~ : String ) -> Bool {
5656 @ffi .path_exists (path )
5757}
5858
@@ -63,8 +63,8 @@ pub fn path_exists(~path : String) -> Bool {
6363///
6464/// # Returns
6565/// A `String` containing the file contents if the file exists, otherwise raises an error.
66- pub fn read_file_to_string (~ path : String ) -> String ! {
67- guard path_exists (~ path ) else { raise IOError ::NotFound (path ) }
66+ pub fn read_file_to_string (path ~ : String ) -> String ! {
67+ guard path_exists (path ~ ) else { raise IOError ::NotFound (path ) }
6868 @ffi .read_file_to_string (path )
6969}
7070
@@ -78,8 +78,8 @@ pub fn read_file_to_string(~path : String) -> String! {
7878/// # Returns
7979///
8080/// - An array of bytes representing the content of the file.
81- pub fn read_file_to_bytes (~ path : String ) -> Bytes ! {
82- guard path_exists (~ path ) else { raise IOError ::NotFound (path ) }
81+ pub fn read_file_to_bytes (path ~ : String ) -> Bytes ! {
82+ guard path_exists (path ~ ) else { raise IOError ::NotFound (path ) }
8383 @ffi .read_file_to_bytes (path )
8484}
8585
@@ -92,8 +92,8 @@ pub fn read_file_to_bytes(~path : String) -> Bytes! {
9292/// # Returns
9393///
9494/// - An array of strings representing the file name and directory name in the directory.
95- pub fn read_dir (~ path : String ) -> Array [String ]! {
96- guard path_exists (~ path ) else { raise IOError ::NotFound (path ) }
95+ pub fn read_dir (path ~ : String ) -> Array [String ]! {
96+ guard path_exists (path ~ ) else { raise IOError ::NotFound (path ) }
9797 @ffi .read_dir (path )
9898}
9999
@@ -103,7 +103,7 @@ pub fn read_dir(~path : String) -> Array[String]! {
103103/// # Parameters
104104///
105105/// - `path` : The path where the directory should be created.
106- pub fn create_dir (~ path : String ) -> Unit {
106+ pub fn create_dir (path ~ : String ) -> Unit {
107107 @ffi .create_dir (path )
108108}
109109
@@ -116,8 +116,8 @@ pub fn create_dir(~path : String) -> Unit {
116116/// # Returns
117117///
118118/// - `Bool` : `true` if the path is a directory, `false` otherwise.
119- pub fn is_dir (~ path : String ) -> Bool ! {
120- guard path_exists (~ path ) else { raise IOError ::NotFound (path ) }
119+ pub fn is_dir (path ~ : String ) -> Bool ! {
120+ guard path_exists (path ~ ) else { raise IOError ::NotFound (path ) }
121121 @ffi .is_dir (path )
122122}
123123
@@ -130,8 +130,8 @@ pub fn is_dir(~path : String) -> Bool! {
130130/// # Returns
131131///
132132/// - `Bool` : `true` if the path points to a file, `false` otherwise.
133- pub fn is_file (~ path : String ) -> Bool ! {
134- guard path_exists (~ path ) else { raise IOError ::NotFound (path ) }
133+ pub fn is_file (path ~ : String ) -> Bool ! {
134+ guard path_exists (path ~ ) else { raise IOError ::NotFound (path ) }
135135 @ffi .is_file (path )
136136}
137137
@@ -140,8 +140,8 @@ pub fn is_file(~path : String) -> Bool! {
140140/// # Parameters
141141///
142142/// - `path` : The string path to the directory that needs to be removed.
143- pub fn remove_dir (~ path : String ) -> Unit ! {
144- guard path_exists (~ path ) else { raise IOError ::NotFound (path ) }
143+ pub fn remove_dir (path ~ : String ) -> Unit ! {
144+ guard path_exists (path ~ ) else { raise IOError ::NotFound (path ) }
145145 @ffi .remove_dir (path )
146146}
147147
@@ -150,7 +150,7 @@ pub fn remove_dir(~path : String) -> Unit! {
150150/// # Parameters
151151///
152152/// - `path` : The path to the file that needs to be removed.
153- pub fn remove_file (~ path : String ) -> Unit ! {
154- guard path_exists (~ path ) else { raise IOError ::NotFound (path ) }
153+ pub fn remove_file (path ~ : String ) -> Unit ! {
154+ guard path_exists (path ~ ) else { raise IOError ::NotFound (path ) }
155155 @ffi .remove_file (path )
156156}
0 commit comments