diff options
| author | Richo Healey <richo@psych0tik.net> | 2014-05-22 16:57:53 -0700 |
|---|---|---|
| committer | Richo Healey <richo@psych0tik.net> | 2014-05-24 21:48:10 -0700 |
| commit | 553074506ecd139eb961fb91eb33ad9fd0183acb (patch) | |
| tree | 01682cf8147183250713acf5e8a77265aab7153c /src/libstd/io | |
| parent | bbb70cdd9cd982922cf7390459d53bde409699ae (diff) | |
core: rename strbuf::StrBuf to string::String
[breaking-change]
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/mod.rs | 14 | ||||
| -rw-r--r-- | src/libstd/io/process.rs | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 0d71c3de76c..c22bc92fb65 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -76,7 +76,7 @@ Some examples of obvious things you might want to do let path = Path::new("message.txt"); let mut file = BufferedReader::new(File::open(&path)); - let lines: Vec<StrBuf> = file.lines().map(|x| x.unwrap()).collect(); + let lines: Vec<String> = file.lines().map(|x| x.unwrap()).collect(); ``` * Make a simple TCP client connection and request @@ -228,7 +228,7 @@ use result::{Ok, Err, Result}; use slice::{Vector, MutableVector, ImmutableVector}; use str::{StrSlice, StrAllocating}; use str; -use strbuf::StrBuf; +use string::String; use uint; use vec::Vec; @@ -293,7 +293,7 @@ pub struct IoError { /// A human-readable description about the error pub desc: &'static str, /// Detailed information about this error, not always available - pub detail: Option<StrBuf> + pub detail: Option<String> } impl IoError { @@ -632,7 +632,7 @@ pub trait Reader { /// This function returns all of the same errors as `read_to_end` with an /// additional error if the reader's contents are not a valid sequence of /// UTF-8 bytes. - fn read_to_str(&mut self) -> IoResult<StrBuf> { + fn read_to_str(&mut self) -> IoResult<String> { self.read_to_end().and_then(|s| { match str::from_utf8(s.as_slice()) { Some(s) => Ok(s.to_strbuf()), @@ -1244,8 +1244,8 @@ pub struct Lines<'r, T> { buffer: &'r mut T, } -impl<'r, T: Buffer> Iterator<IoResult<StrBuf>> for Lines<'r, T> { - fn next(&mut self) -> Option<IoResult<StrBuf>> { +impl<'r, T: Buffer> Iterator<IoResult<String>> for Lines<'r, T> { + fn next(&mut self) -> Option<IoResult<String>> { match self.buffer.read_line() { Ok(x) => Some(Ok(x)), Err(IoError { kind: EndOfFile, ..}) => None, @@ -1330,7 +1330,7 @@ pub trait Buffer: Reader { /// /// Additionally, this function can fail if the line of input read is not a /// valid UTF-8 sequence of bytes. - fn read_line(&mut self) -> IoResult<StrBuf> { + fn read_line(&mut self) -> IoResult<String> { self.read_until('\n' as u8).and_then(|line| match str::from_utf8(line.as_slice()) { Some(s) => Ok(s.to_strbuf()), diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index d2a83dd840d..468bf5551b3 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -583,11 +583,11 @@ mod tests { } }) - pub fn read_all(input: &mut Reader) -> StrBuf { + pub fn read_all(input: &mut Reader) -> String { input.read_to_str().unwrap() } - pub fn run_output(cmd: Command) -> StrBuf { + pub fn run_output(cmd: Command) -> String { let p = cmd.spawn(); assert!(p.is_ok()); let mut p = p.unwrap(); |
