Skip to content

Commit a5275ff

Browse files
committed
std: whitespace clean up io::file docs
1 parent 5d9932f commit a5275ff

File tree

1 file changed

+52
-52
lines changed

1 file changed

+52
-52
lines changed

src/libstd/rt/io/file.rs

+52-52
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ use path::Path;
4545
use super::super::test::*;
4646

4747
/// Open a file for reading/writing, as indicated by `path`.
48-
///
48+
///
4949
/// # Example
50-
///
50+
///
5151
/// use std;
5252
/// use std::path::Path;
5353
/// use std::rt::io::support::PathLike;
5454
/// use std::rt::io::file::open;
5555
/// use std::rt::io::{FileMode, FileAccess};
56-
///
56+
///
5757
/// let p = &Path("/some/file/path.txt");
58-
///
58+
///
5959
/// do io_error::cond.trap(|_| {
6060
/// // hoo-boy...
6161
/// }).inside {
@@ -64,26 +64,26 @@ use super::super::test::*;
6464
/// None => fail!("whoops! I'm sure this raised, anyways..");
6565
/// }
6666
/// // do some stuff with that stream
67-
///
67+
///
6868
/// // the file stream will be closed at the end of this block
6969
/// }
7070
/// // ..
71-
///
71+
///
7272
/// `FileMode` and `FileAccess` provide information about the permissions
7373
/// context in which a given stream is created. More information about them
7474
/// can be found in `std::rt::io`'s docs.
75-
///
75+
///
7676
/// Note that, with this function, a `FileStream` is returned regardless of
7777
/// the access-limitations indicated by `FileAccess` (e.g. calling `write` on a
7878
/// `FileStream` opened as `ReadOnly` will raise an `io_error` condition at runtime). If you
7979
/// desire a more-correctly-constrained interface to files, use the
8080
/// `{open_stream, open_reader, open_writer}` methods that are a part of `FileInfo`
81-
///
81+
///
8282
/// # Errors
83-
///
83+
///
8484
/// This function will raise an `io_error` condition under a number of different circumstances,
8585
/// to include but not limited to:
86-
///
86+
///
8787
/// * Opening a file that already exists with `FileMode` of `Create` or vice versa (e.g.
8888
/// opening a non-existant file with `FileMode` or `Open`)
8989
/// * Attempting to open a file with a `FileAccess` that the user lacks permissions
@@ -110,25 +110,25 @@ pub fn open<P: PathLike>(path: &P,
110110
}
111111

112112
/// Unlink a file from the underlying filesystem.
113-
///
113+
///
114114
/// # Example
115-
///
115+
///
116116
/// use std;
117117
/// use std::path::Path;
118118
/// use std::rt::io::support::PathLike;
119119
/// use std::rt::io::file::unlink;
120-
///
120+
///
121121
/// let p = &Path("/some/file/path.txt");
122122
/// unlink(p);
123123
/// // if we made it here without failing, then the
124124
/// // unlink operation was successful
125-
///
125+
///
126126
/// Note that, just because an unlink call was successful, it is not
127127
/// guaranteed that a file is immediately deleted (e.g. depending on
128128
/// platform, other open file descriptors may prevent immediate removal)
129-
///
129+
///
130130
/// # Errors
131-
///
131+
///
132132
/// This function will raise an `io_error` condition if the user lacks permissions to
133133
/// remove the file or if some other filesystem-level error occurs
134134
pub fn unlink<P: PathLike>(path: &P) {
@@ -145,20 +145,20 @@ pub fn unlink<P: PathLike>(path: &P) {
145145
}
146146

147147
/// Create a new, empty directory at the provided path
148-
///
148+
///
149149
/// # Example
150-
///
150+
///
151151
/// use std;
152152
/// use std::path::Path;
153153
/// use std::rt::io::support::PathLike;
154154
/// use std::rt::io::file::mkdir;
155-
///
155+
///
156156
/// let p = &Path("/some/dir");
157157
/// mkdir(p);
158158
/// // If we got here, our directory exists! Horray!
159-
///
159+
///
160160
/// # Errors
161-
///
161+
///
162162
/// This call will raise an `io_error` condition if the user lacks permissions to make a
163163
/// new directory at the provided path, or if the directory already exists
164164
pub fn mkdir<P: PathLike>(path: &P) {
@@ -175,20 +175,20 @@ pub fn mkdir<P: PathLike>(path: &P) {
175175
}
176176

177177
/// Remove an existing, empty directory
178-
///
178+
///
179179
/// # Example
180-
///
180+
///
181181
/// use std;
182182
/// use std::path::Path;
183183
/// use std::rt::io::support::PathLike;
184184
/// use std::rt::io::file::rmdir;
185-
///
185+
///
186186
/// let p = &Path("/some/dir");
187187
/// rmdir(p);
188188
/// // good riddance, you mean ol' directory
189-
///
189+
///
190190
/// # Errors
191-
///
191+
///
192192
/// This call will raise an `io_error` condition if the user lacks permissions to remove the
193193
/// directory at the provided path, or if the directory isn't empty
194194
pub fn rmdir<P: PathLike>(path: &P) {
@@ -205,21 +205,21 @@ pub fn rmdir<P: PathLike>(path: &P) {
205205
}
206206

207207
/// Get information on the file, directory, etc at the provided path
208-
///
208+
///
209209
/// Given a `rt::io::support::PathLike`, query the file system to get
210210
/// information about a file, directory, etc.
211-
///
211+
///
212212
/// Returns a `Some(std::rt::io::PathInfo)` on success
213-
///
213+
///
214214
/// # Example
215-
///
215+
///
216216
/// use std;
217217
/// use std::path::Path;
218218
/// use std::rt::io::support::PathLike;
219219
/// use std::rt::io::file::stat;
220-
///
220+
///
221221
/// let p = &Path("/some/file/path.txt");
222-
///
222+
///
223223
/// do io_error::cond.trap(|_| {
224224
/// // hoo-boy...
225225
/// }).inside {
@@ -230,13 +230,13 @@ pub fn rmdir<P: PathLike>(path: &P) {
230230
/// if stat.is_file {
231231
/// // just imagine the possibilities ...
232232
/// }
233-
///
233+
///
234234
/// // the file stream will be closed at the end of this block
235235
/// }
236236
/// // ..
237-
///
237+
///
238238
/// # Errors
239-
///
239+
///
240240
/// This call will raise an `io_error` condition if the user lacks the requisite
241241
/// permissions to perform a `stat` call on the given path or if there is no
242242
/// entry in the filesystem at the provided path.
@@ -325,7 +325,7 @@ impl Seek for FileReader {
325325
}
326326

327327
/// Constrained version of `FileStream` that only exposes write-specific operations.
328-
///
328+
///
329329
/// Can be retreived via `FileInfo.open_writer()`.
330330
pub struct FileWriter { priv stream: FileStream }
331331

@@ -352,15 +352,15 @@ impl Seek for FileWriter {
352352
}
353353

354354
/// Unconstrained file access type that exposes read and write operations
355-
///
355+
///
356356
/// Can be retreived via `file::open()` and `FileInfo.open_stream()`.
357-
///
357+
///
358358
/// # Errors
359-
///
359+
///
360360
/// This type will raise an io_error condition if operations are attempted against
361361
/// it for which its underlying file descriptor was not configured at creation
362362
/// time, via the `FileAccess` parameter to `file::open()`.
363-
///
363+
///
364364
/// For this reason, it is best to use the access-constrained wrappers that are
365365
/// exposed via `FileInfo.open_reader()` and `FileInfo.open_writer()`.
366366
pub struct FileStream {
@@ -474,25 +474,25 @@ pub trait FileSystemInfo {
474474
}
475475

476476
/// Represents a file, whose underlying path may or may not be valid
477-
///
477+
///
478478
/// # Example
479-
///
479+
///
480480
/// * Check if a file exists, reading from it if so
481-
///
481+
///
482482
/// use std;
483483
/// use std::path::Path;
484484
/// use std::rt::io::file::{FileInfo, FileReader};
485-
///
485+
///
486486
/// let f = &Path("/some/file/path.txt");
487487
/// if f.exists() {
488488
/// let reader = f.open_reader(Open);
489489
/// let mut mem = [0u8, 8*64000];
490490
/// reader.read(mem);
491491
/// // ...
492492
/// }
493-
///
493+
///
494494
/// * Is the given path a file?
495-
///
495+
///
496496
/// let f = get_file_path_from_wherever();
497497
/// match f.is_file() {
498498
/// true => doing_something_with_a_file(f),
@@ -567,22 +567,22 @@ impl FileSystemInfo for Path {
567567
impl FileInfo for Path { }
568568

569569
/// Represents a directory, whose underlying path may or may not be valid
570-
///
570+
///
571571
/// # Example
572-
///
572+
///
573573
/// * Check if a directory exists, `mkdir`'ing it if not
574-
///
574+
///
575575
/// use std;
576576
/// use std::path::Path;
577577
/// use std::rt::io::file::{DirectoryInfo};
578-
///
578+
///
579579
/// let dir = &Path("/some/dir");
580580
/// if !dir.exists() {
581581
/// dir.mkdir();
582582
/// }
583-
///
583+
///
584584
/// * Is the given path a directory? If so, iterate on its contents
585-
///
585+
///
586586
/// fn visit_dirs(dir: &Path, cb: &fn(&Path)) {
587587
/// if dir.is_dir() {
588588
/// let contents = dir.readdir();

0 commit comments

Comments
 (0)