// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+//
+// ignore-lexer-test FIXME #15883
// FIXME: cover these topics:
// path, reader, writer, stream, raii (close not needed),
use char::Char;
use collections::Collection;
+use default::Default;
use fmt;
use int;
use iter::Iterator;
use ops::{BitOr, BitAnd, Sub, Not};
use option::{Option, Some, None};
use os;
-use owned::Box;
+use boxed::Box;
use result::{Ok, Err, Result};
use rt::rtio;
use slice::{Vector, MutableVector, ImmutableVector};
use str;
use string::String;
use uint;
+use unicode::char::UnicodeChar;
use vec::Vec;
// Reexports
/// # FIXME
///
/// Is something like this sufficient? It's kind of archaic
-#[deriving(PartialEq, Clone)]
+#[deriving(PartialEq, Eq, Clone)]
pub struct IoError {
/// An enumeration which can be matched against for determining the flavor
/// of error.
}
/// A list specifying general categories of I/O error.
-#[deriving(PartialEq, Clone, Show)]
+#[deriving(PartialEq, Eq, Clone, Show)]
pub enum IoErrorKind {
/// Any I/O error not part of this list.
OtherIoError,
/// UTF-8 bytes.
fn read_to_string(&mut self) -> IoResult<String> {
self.read_to_end().and_then(|s| {
- match str::from_utf8(s.as_slice()) {
- Some(s) => Ok(String::from_str(s)),
- None => Err(standard_error(InvalidInput)),
+ match String::from_utf8(s) {
+ Ok(s) => Ok(s),
+ Err(_) => Err(standard_error(InvalidInput)),
}
})
}
/// valid UTF-8 sequence of bytes.
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(String::from_str(s)),
- None => Err(standard_error(InvalidInput)),
+ match String::from_utf8(line) {
+ Ok(s) => Ok(s),
+ Err(_) => Err(standard_error(InvalidInput)),
}
)
}
bitflags!(
#[doc="A set of permissions for a file or directory is represented
by a set of flags which are or'd together."]
- #[deriving(Hash)]
#[deriving(Show)]
flags FilePermission: u32 {
static UserRead = 0o400,
}
)
+impl Default for FilePermission {
+ #[inline]
+ fn default() -> FilePermission { FilePermission::empty() }
+}
+
#[cfg(test)]
mod tests {
use super::{IoResult, Reader, MemReader, NoProgress, InvalidInput};