1
Fork 0

Add new path module

Implements [RFC 474](https://github.com/rust-lang/rfcs/pull/474); see
that RFC for details/motivation for this change.

This initial commit does not include additional normalization or
platform-specific path extensions. These will be done in follow up
commits or PRs.
This commit is contained in:
Aaron Turon 2015-01-29 14:33:11 -08:00
parent 3e39f0bc0e
commit 45ddf50ceb
8 changed files with 2576 additions and 9 deletions

View file

@ -24,6 +24,7 @@ pub use self::os_str::OsStr;
mod c_str; mod c_str;
mod os_str; mod os_str;
// FIXME (#21670): these should be defined in the os_str module
/// Freely convertible to an `&OsStr` slice. /// Freely convertible to an `&OsStr` slice.
pub trait AsOsStr { pub trait AsOsStr {
/// Convert to an `&OsStr` slice. /// Convert to an `&OsStr` slice.

View file

@ -41,7 +41,7 @@ use string::{String, CowString};
use ops; use ops;
use cmp; use cmp;
use hash::{Hash, Hasher, Writer}; use hash::{Hash, Hasher, Writer};
use path::{Path, GenericPath}; use old_path::{Path, GenericPath};
use sys::os_str::{Buf, Slice}; use sys::os_str::{Buf, Slice};
use sys_common::{AsInner, IntoInner, FromInner}; use sys_common::{AsInner, IntoInner, FromInner};

2567
src/libstd/path.rs Executable file

File diff suppressed because it is too large Load diff

View file

@ -20,7 +20,7 @@ use str;
use string::{String, CowString}; use string::{String, CowString};
use mem; use mem;
#[derive(Clone)] #[derive(Clone, Hash)]
pub struct Buf { pub struct Buf {
pub inner: Vec<u8> pub inner: Vec<u8>
} }

View file

@ -18,7 +18,7 @@ use result::Result;
use option::Option; use option::Option;
use mem; use mem;
#[derive(Clone)] #[derive(Clone, Hash)]
pub struct Buf { pub struct Buf {
pub inner: Wtf8Buf pub inner: Wtf8Buf
} }

View file

@ -11,7 +11,7 @@
use std::slice::SliceExt; use std::slice::SliceExt;
use std::old_io::{Command, fs, USER_RWX}; use std::old_io::{Command, fs, USER_RWX};
use std::os; use std::os;
use std::path::BytesContainer; use std::old_path::BytesContainer;
use std::rand::random; use std::rand::random;
fn main() { fn main() {

View file

@ -1,4 +1,3 @@
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
@ -15,8 +14,8 @@
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(unboxed_closures)] #![feature(unboxed_closures)]
use std::path::{Path}; use std::old_path::{Path};
use std::path; use std::old_path;
use std::result; use std::result;
use std::thunk::Thunk; use std::thunk::Thunk;
@ -28,7 +27,7 @@ fn tester()
result::Result::Ok("more blah".to_string()) result::Result::Ok("more blah".to_string())
}; };
let path = path::Path::new("blah"); let path = old_path::Path::new("blah");
assert!(loader(&path).is_ok()); assert!(loader(&path).is_ok());
} }

View file

@ -20,7 +20,7 @@ use std::old_io;
use std::old_io::fs; use std::old_io::fs;
use std::old_io::Command; use std::old_io::Command;
use std::os; use std::os;
use std::path::Path; use std::old_path::Path;
fn main() { fn main() {
let my_args = os::args(); let my_args = os::args();