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 @@
mod c_str;
mod os_str;
// FIXME (#21670): these should be defined in the os_str module
/// Freely convertible to an `&OsStr` slice.
pub trait AsOsStr {
/// Convert to an `&OsStr` slice.

View File

@ -41,7 +41,7 @@
use ops;
use cmp;
use hash::{Hash, Hasher, Writer};
use path::{Path, GenericPath};
use old_path::{Path, GenericPath};
use sys::os_str::{Buf, Slice};
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 string::{String, CowString};
use mem;
#[derive(Clone)]
#[derive(Clone, Hash)]
pub struct Buf {
pub inner: Vec<u8>
}

View File

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

View File

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

View File

@ -1,4 +1,3 @@
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
@ -15,8 +14,8 @@
#![feature(box_syntax)]
#![feature(unboxed_closures)]
use std::path::{Path};
use std::path;
use std::old_path::{Path};
use std::old_path;
use std::result;
use std::thunk::Thunk;
@ -28,7 +27,7 @@ fn tester()
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());
}

View File

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