std: Rename slice::Vector to Slice
This required some contortions because importing both raw::Slice and slice::Slice makes rustc crash. Since `Slice` is in the prelude, this renaming is unlikely to casue breakage. [breaking-change]
This commit is contained in:
parent
4f5b6927e8
commit
fbc93082ec
20 changed files with 50 additions and 44 deletions
|
@ -98,7 +98,7 @@ use {Collection, MutableSeq};
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows};
|
pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows};
|
||||||
pub use core::slice::{Chunks, Vector, ImmutableSlice, ImmutableEqSlice};
|
pub use core::slice::{Chunks, Slice, ImmutableSlice, ImmutableEqSlice};
|
||||||
pub use core::slice::{ImmutableOrdSlice, MutableSlice, Items, MutItems};
|
pub use core::slice::{ImmutableOrdSlice, MutableSlice, Items, MutItems};
|
||||||
pub use core::slice::{MutSplits, MutChunks};
|
pub use core::slice::{MutSplits, MutChunks};
|
||||||
pub use core::slice::{bytes, MutableCloneableSlice};
|
pub use core::slice::{bytes, MutableCloneableSlice};
|
||||||
|
@ -116,7 +116,7 @@ pub trait VectorVector<T> {
|
||||||
fn connect_vec(&self, sep: &T) -> Vec<T>;
|
fn connect_vec(&self, sep: &T) -> Vec<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Clone, V: Vector<T>> VectorVector<T> for &'a [V] {
|
impl<'a, T: Clone, V: Slice<T>> VectorVector<T> for &'a [V] {
|
||||||
fn concat_vec(&self) -> Vec<T> {
|
fn concat_vec(&self) -> Vec<T> {
|
||||||
let size = self.iter().fold(0u, |acc, v| acc + v.as_slice().len());
|
let size = self.iter().fold(0u, |acc, v| acc + v.as_slice().len());
|
||||||
let mut result = Vec::with_capacity(size);
|
let mut result = Vec::with_capacity(size);
|
||||||
|
|
|
@ -18,12 +18,15 @@ use core::default::Default;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::ptr;
|
use core::ptr;
|
||||||
use core::raw::Slice;
|
// FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait
|
||||||
|
use RawSlice = core::raw::Slice;
|
||||||
|
use core::slice::Slice;
|
||||||
|
|
||||||
use {Collection, Mutable, MutableSeq};
|
use {Collection, Mutable, MutableSeq};
|
||||||
use hash;
|
use hash;
|
||||||
use str;
|
use str;
|
||||||
use str::{CharRange, StrAllocating, MaybeOwned, Owned, Slice};
|
use str::{CharRange, StrAllocating, MaybeOwned, Owned};
|
||||||
|
use MaybeOwnedSlice = str::Slice; // So many `Slice`s...
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
/// A growable string stored as a UTF-8 encoded buffer.
|
/// A growable string stored as a UTF-8 encoded buffer.
|
||||||
|
@ -130,7 +133,7 @@ impl String {
|
||||||
/// ```
|
/// ```
|
||||||
pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> {
|
pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> {
|
||||||
if str::is_utf8(v) {
|
if str::is_utf8(v) {
|
||||||
return Slice(unsafe { mem::transmute(v) })
|
return MaybeOwnedSlice(unsafe { mem::transmute(v) })
|
||||||
}
|
}
|
||||||
|
|
||||||
static TAG_CONT_U8: u8 = 128u8;
|
static TAG_CONT_U8: u8 = 128u8;
|
||||||
|
@ -496,7 +499,7 @@ impl String {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Attempt to not use an intermediate buffer by just pushing bytes
|
// Attempt to not use an intermediate buffer by just pushing bytes
|
||||||
// directly onto this string.
|
// directly onto this string.
|
||||||
let slice = Slice {
|
let slice = RawSlice {
|
||||||
data: self.vec.as_ptr().offset(cur_len as int),
|
data: self.vec.as_ptr().offset(cur_len as int),
|
||||||
len: 4,
|
len: 4,
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
|
|
||||||
use alloc::heap::{allocate, reallocate, deallocate};
|
use alloc::heap::{allocate, reallocate, deallocate};
|
||||||
use core::raw::Slice;
|
use RawSlice = core::raw::Slice;
|
||||||
|
use core::slice::Slice;
|
||||||
use core::cmp::max;
|
use core::cmp::max;
|
||||||
use core::default::Default;
|
use core::default::Default;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
@ -506,7 +507,7 @@ impl<T: PartialOrd> PartialOrd for Vec<T> {
|
||||||
|
|
||||||
impl<T: Eq> Eq for Vec<T> {}
|
impl<T: Eq> Eq for Vec<T> {}
|
||||||
|
|
||||||
impl<T: PartialEq, V: Vector<T>> Equiv<V> for Vec<T> {
|
impl<T: PartialEq, V: Slice<T>> Equiv<V> for Vec<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
|
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
|
||||||
}
|
}
|
||||||
|
@ -720,7 +721,7 @@ impl<T> Vec<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
|
pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
|
||||||
unsafe {
|
unsafe {
|
||||||
mem::transmute(Slice {
|
mem::transmute(RawSlice {
|
||||||
data: self.as_mut_ptr() as *const T,
|
data: self.as_mut_ptr() as *const T,
|
||||||
len: self.len,
|
len: self.len,
|
||||||
})
|
})
|
||||||
|
@ -1502,7 +1503,7 @@ impl<T:PartialEq> Vec<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Vector<T> for Vec<T> {
|
impl<T> Slice<T> for Vec<T> {
|
||||||
/// Work with `self` as a slice.
|
/// Work with `self` as a slice.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
|
@ -1515,11 +1516,11 @@ impl<T> Vector<T> for Vec<T> {
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
fn as_slice<'a>(&'a self) -> &'a [T] {
|
fn as_slice<'a>(&'a self) -> &'a [T] {
|
||||||
unsafe { mem::transmute(Slice { data: self.as_ptr(), len: self.len }) }
|
unsafe { mem::transmute(RawSlice { data: self.as_ptr(), len: self.len }) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Clone, V: Vector<T>> Add<V, Vec<T>> for Vec<T> {
|
impl<T: Clone, V: Slice<T>> Add<V, Vec<T>> for Vec<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn add(&self, rhs: &V) -> Vec<T> {
|
fn add(&self, rhs: &V) -> Vec<T> {
|
||||||
let mut res = Vec::with_capacity(self.len() + rhs.as_slice().len());
|
let mut res = Vec::with_capacity(self.len() + rhs.as_slice().len());
|
||||||
|
|
|
@ -24,7 +24,7 @@ use option::{Option, Some, None};
|
||||||
use ops::Deref;
|
use ops::Deref;
|
||||||
use result::{Ok, Err};
|
use result::{Ok, Err};
|
||||||
use result;
|
use result;
|
||||||
use slice::{Vector, ImmutableSlice};
|
use slice::{Slice, ImmutableSlice};
|
||||||
use slice;
|
use slice;
|
||||||
use str::StrSlice;
|
use str::StrSlice;
|
||||||
use str;
|
use str;
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
|
|
||||||
use cmp::{PartialEq, Eq, Ord};
|
use cmp::{PartialEq, Eq, Ord};
|
||||||
use default::Default;
|
use default::Default;
|
||||||
use slice::Vector;
|
use slice::Slice;
|
||||||
use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize};
|
use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize};
|
||||||
use mem;
|
use mem;
|
||||||
use slice;
|
use slice;
|
||||||
|
@ -518,7 +518,7 @@ impl<T: Default> Option<T> {
|
||||||
// Trait implementations
|
// Trait implementations
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
impl<T> Vector<T> for Option<T> {
|
impl<T> Slice<T> for Option<T> {
|
||||||
/// Convert from `Option<T>` to `&[T]` (without copying)
|
/// Convert from `Option<T>` to `&[T]` (without copying)
|
||||||
#[inline]
|
#[inline]
|
||||||
fn as_slice<'a>(&'a self) -> &'a [T] {
|
fn as_slice<'a>(&'a self) -> &'a [T] {
|
||||||
|
|
|
@ -63,4 +63,4 @@ pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
|
||||||
pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
|
pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
|
||||||
pub use slice::{ImmutableEqSlice, ImmutableOrdSlice};
|
pub use slice::{ImmutableEqSlice, ImmutableOrdSlice};
|
||||||
pub use slice::{MutableSlice};
|
pub use slice::{MutableSlice};
|
||||||
pub use slice::{Vector, ImmutableSlice};
|
pub use slice::{Slice, ImmutableSlice};
|
||||||
|
|
|
@ -47,7 +47,9 @@ use ptr::RawPtr;
|
||||||
use mem;
|
use mem;
|
||||||
use mem::size_of;
|
use mem::size_of;
|
||||||
use kinds::marker;
|
use kinds::marker;
|
||||||
use raw::{Repr, Slice};
|
use raw::{Repr};
|
||||||
|
// Avoid conflicts with *both* the Slice trait (buggy) and the `slice::raw` module.
|
||||||
|
use RawSlice = raw::Slice;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extension traits
|
// Extension traits
|
||||||
|
@ -240,7 +242,7 @@ impl<'a,T> ImmutableSlice<'a, T> for &'a [T] {
|
||||||
assert!(start <= end);
|
assert!(start <= end);
|
||||||
assert!(end <= self.len());
|
assert!(end <= self.len());
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute(Slice {
|
transmute(RawSlice {
|
||||||
data: self.as_ptr().offset(start as int),
|
data: self.as_ptr().offset(start as int),
|
||||||
len: (end - start)
|
len: (end - start)
|
||||||
})
|
})
|
||||||
|
@ -380,7 +382,7 @@ impl<'a,T> ImmutableSlice<'a, T> for &'a [T] {
|
||||||
|
|
||||||
fn shift_ref(&mut self) -> Option<&'a T> {
|
fn shift_ref(&mut self) -> Option<&'a T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let s: &mut Slice<T> = transmute(self);
|
let s: &mut RawSlice<T> = transmute(self);
|
||||||
match raw::shift_ptr(s) {
|
match raw::shift_ptr(s) {
|
||||||
Some(p) => Some(&*p),
|
Some(p) => Some(&*p),
|
||||||
None => None
|
None => None
|
||||||
|
@ -390,7 +392,7 @@ impl<'a,T> ImmutableSlice<'a, T> for &'a [T] {
|
||||||
|
|
||||||
fn pop_ref(&mut self) -> Option<&'a T> {
|
fn pop_ref(&mut self) -> Option<&'a T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let s: &mut Slice<T> = transmute(self);
|
let s: &mut RawSlice<T> = transmute(self);
|
||||||
match raw::pop_ptr(s) {
|
match raw::pop_ptr(s) {
|
||||||
Some(p) => Some(&*p),
|
Some(p) => Some(&*p),
|
||||||
None => None
|
None => None
|
||||||
|
@ -620,7 +622,7 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] {
|
||||||
assert!(start <= end);
|
assert!(start <= end);
|
||||||
assert!(end <= self.len());
|
assert!(end <= self.len());
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute(Slice {
|
transmute(RawSlice {
|
||||||
data: self.as_mut_ptr().offset(start as int) as *const T,
|
data: self.as_mut_ptr().offset(start as int) as *const T,
|
||||||
len: (end - start)
|
len: (end - start)
|
||||||
})
|
})
|
||||||
|
@ -685,7 +687,7 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] {
|
||||||
|
|
||||||
fn mut_shift_ref(&mut self) -> Option<&'a mut T> {
|
fn mut_shift_ref(&mut self) -> Option<&'a mut T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let s: &mut Slice<T> = transmute(self);
|
let s: &mut RawSlice<T> = transmute(self);
|
||||||
match raw::shift_ptr(s) {
|
match raw::shift_ptr(s) {
|
||||||
// FIXME #13933: this `&` -> `&mut` cast is a little
|
// FIXME #13933: this `&` -> `&mut` cast is a little
|
||||||
// dubious
|
// dubious
|
||||||
|
@ -697,7 +699,7 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] {
|
||||||
|
|
||||||
fn mut_pop_ref(&mut self) -> Option<&'a mut T> {
|
fn mut_pop_ref(&mut self) -> Option<&'a mut T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let s: &mut Slice<T> = transmute(self);
|
let s: &mut RawSlice<T> = transmute(self);
|
||||||
match raw::pop_ptr(s) {
|
match raw::pop_ptr(s) {
|
||||||
// FIXME #13933: this `&` -> `&mut` cast is a little
|
// FIXME #13933: this `&` -> `&mut` cast is a little
|
||||||
// dubious
|
// dubious
|
||||||
|
@ -859,12 +861,12 @@ impl<'a, T:Clone> MutableCloneableSlice<T> for &'a mut [T] {
|
||||||
//
|
//
|
||||||
|
|
||||||
/// Any vector that can be represented as a slice.
|
/// Any vector that can be represented as a slice.
|
||||||
pub trait Vector<T> {
|
pub trait Slice<T> {
|
||||||
/// Work with `self` as a slice.
|
/// Work with `self` as a slice.
|
||||||
fn as_slice<'a>(&'a self) -> &'a [T];
|
fn as_slice<'a>(&'a self) -> &'a [T];
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a,T> Vector<T> for &'a [T] {
|
impl<'a,T> Slice<T> for &'a [T] {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn as_slice<'a>(&'a self) -> &'a [T] { *self }
|
fn as_slice<'a>(&'a self) -> &'a [T] { *self }
|
||||||
}
|
}
|
||||||
|
@ -1323,7 +1325,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunks<'a, T> {
|
||||||
*/
|
*/
|
||||||
pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
|
pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
|
||||||
unsafe {
|
unsafe {
|
||||||
transmute(Slice { data: s, len: 1 })
|
transmute(RawSlice { data: s, len: 1 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1333,7 +1335,7 @@ pub fn ref_slice<'a, A>(s: &'a A) -> &'a [A] {
|
||||||
pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
|
pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr: *const A = transmute(s);
|
let ptr: *const A = transmute(s);
|
||||||
transmute(Slice { data: ptr, len: 1 })
|
transmute(RawSlice { data: ptr, len: 1 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,7 +1462,7 @@ impl<'a,T:PartialEq> PartialEq for &'a [T] {
|
||||||
|
|
||||||
impl<'a,T:Eq> Eq for &'a [T] {}
|
impl<'a,T:Eq> Eq for &'a [T] {}
|
||||||
|
|
||||||
impl<'a,T:PartialEq, V: Vector<T>> Equiv<V> for &'a [T] {
|
impl<'a,T:PartialEq, V: Slice<T>> Equiv<V> for &'a [T] {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
|
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ impl<'a, T: Ord> Ord for MaybeOwnedVector<'a, T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: PartialEq, V: Vector<T>> Equiv<V> for MaybeOwnedVector<'a, T> {
|
impl<'a, T: PartialEq, V: Slice<T>> Equiv<V> for MaybeOwnedVector<'a, T> {
|
||||||
fn equiv(&self, other: &V) -> bool {
|
fn equiv(&self, other: &V) -> bool {
|
||||||
self.as_slice() == other.as_slice()
|
self.as_slice() == other.as_slice()
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ impl<'a, T: PartialEq, V: Vector<T>> Equiv<V> for MaybeOwnedVector<'a, T> {
|
||||||
// In any case, with `Vector` in place, the client can just use
|
// In any case, with `Vector` in place, the client can just use
|
||||||
// `as_slice` if they prefer that over `match`.
|
// `as_slice` if they prefer that over `match`.
|
||||||
|
|
||||||
impl<'b,T> slice::Vector<T> for MaybeOwnedVector<'b,T> {
|
impl<'b,T> Slice<T> for MaybeOwnedVector<'b,T> {
|
||||||
fn as_slice<'a>(&'a self) -> &'a [T] {
|
fn as_slice<'a>(&'a self) -> &'a [T] {
|
||||||
match self {
|
match self {
|
||||||
&Growable(ref v) => v.as_slice(),
|
&Growable(ref v) => v.as_slice(),
|
||||||
|
|
|
@ -379,7 +379,7 @@ fn mk_test_module(cx: &TestCtxt, reexport_test_harness_main: &Option<InternedStr
|
||||||
let mainfn = (quote_item!(&cx.ext_cx,
|
let mainfn = (quote_item!(&cx.ext_cx,
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
#![main]
|
#![main]
|
||||||
use std::slice::Vector;
|
use std::slice::Slice;
|
||||||
test::test_main_static(::std::os::args().as_slice(), TESTS);
|
test::test_main_static(::std::os::args().as_slice(), TESTS);
|
||||||
}
|
}
|
||||||
)).unwrap();
|
)).unwrap();
|
||||||
|
|
|
@ -19,7 +19,7 @@ use fmt;
|
||||||
use iter::Iterator;
|
use iter::Iterator;
|
||||||
use mem;
|
use mem;
|
||||||
use option::{Option, Some, None};
|
use option::{Option, Some, None};
|
||||||
use slice::{ImmutableSlice, MutableSlice, Vector};
|
use slice::{ImmutableSlice, MutableSlice, Slice};
|
||||||
use str::{Str, StrSlice};
|
use str::{Str, StrSlice};
|
||||||
use str;
|
use str;
|
||||||
use string::String;
|
use string::String;
|
||||||
|
|
|
@ -43,7 +43,7 @@ use option::{Option, Some, None};
|
||||||
use ptr::RawPtr;
|
use ptr::RawPtr;
|
||||||
use ptr;
|
use ptr;
|
||||||
use raw;
|
use raw;
|
||||||
use slice::Vector;
|
use slice::Slice;
|
||||||
|
|
||||||
/// The type representing a foreign chunk of memory
|
/// The type representing a foreign chunk of memory
|
||||||
pub struct CVec<T> {
|
pub struct CVec<T> {
|
||||||
|
@ -145,7 +145,7 @@ impl<T> CVec<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Vector<T> for CVec<T> {
|
impl<T> Slice<T> for CVec<T> {
|
||||||
/// View the stored data as a slice.
|
/// View the stored data as a slice.
|
||||||
fn as_slice<'a>(&'a self) -> &'a [T] {
|
fn as_slice<'a>(&'a self) -> &'a [T] {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -29,7 +29,7 @@ use option::*;
|
||||||
use os;
|
use os;
|
||||||
use path::{Path,GenericPath};
|
use path::{Path,GenericPath};
|
||||||
use result::*;
|
use result::*;
|
||||||
use slice::{Vector,ImmutableSlice};
|
use slice::{Slice,ImmutableSlice};
|
||||||
use str;
|
use str;
|
||||||
use string::String;
|
use string::String;
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
|
@ -21,7 +21,7 @@ use option::{Option, Some, None};
|
||||||
use result::{Ok, Err};
|
use result::{Ok, Err};
|
||||||
use io;
|
use io;
|
||||||
use io::{IoError, IoResult, Reader};
|
use io::{IoError, IoResult, Reader};
|
||||||
use slice::{ImmutableSlice, Vector};
|
use slice::{ImmutableSlice, Slice};
|
||||||
use ptr::RawPtr;
|
use ptr::RawPtr;
|
||||||
|
|
||||||
/// An iterator that reads a single byte on each iteration,
|
/// An iterator that reads a single byte on each iteration,
|
||||||
|
|
|
@ -19,7 +19,7 @@ use result::{Err, Ok};
|
||||||
use io;
|
use io;
|
||||||
use io::{Reader, Writer, Seek, Buffer, IoError, SeekStyle, IoResult};
|
use io::{Reader, Writer, Seek, Buffer, IoError, SeekStyle, IoResult};
|
||||||
use slice;
|
use slice;
|
||||||
use slice::{Vector, ImmutableSlice, MutableSlice};
|
use slice::{Slice, ImmutableSlice, MutableSlice};
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
static BUF_CAPACITY: uint = 128;
|
static BUF_CAPACITY: uint = 128;
|
||||||
|
|
|
@ -235,7 +235,7 @@ use os;
|
||||||
use boxed::Box;
|
use boxed::Box;
|
||||||
use result::{Ok, Err, Result};
|
use result::{Ok, Err, Result};
|
||||||
use rt::rtio;
|
use rt::rtio;
|
||||||
use slice::{Vector, MutableSlice, ImmutableSlice};
|
use slice::{Slice, MutableSlice, ImmutableSlice};
|
||||||
use str::{Str, StrSlice};
|
use str::{Str, StrSlice};
|
||||||
use str;
|
use str;
|
||||||
use string::String;
|
use string::String;
|
||||||
|
|
|
@ -45,7 +45,7 @@ use path::{Path, GenericPath, BytesContainer};
|
||||||
use ptr::RawPtr;
|
use ptr::RawPtr;
|
||||||
use ptr;
|
use ptr;
|
||||||
use result::{Err, Ok, Result};
|
use result::{Err, Ok, Result};
|
||||||
use slice::{Vector, ImmutableSlice, MutableSlice, ImmutableEqSlice};
|
use slice::{Slice, ImmutableSlice, MutableSlice, ImmutableEqSlice};
|
||||||
use str::{Str, StrSlice, StrAllocating};
|
use str::{Str, StrSlice, StrAllocating};
|
||||||
use string::String;
|
use string::String;
|
||||||
use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
|
use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
|
||||||
|
|
|
@ -74,7 +74,7 @@ use option::{Option, None, Some};
|
||||||
use str;
|
use str;
|
||||||
use str::{MaybeOwned, Str, StrSlice};
|
use str::{MaybeOwned, Str, StrSlice};
|
||||||
use string::String;
|
use string::String;
|
||||||
use slice::Vector;
|
use slice::Slice;
|
||||||
use slice::{ImmutableEqSlice, ImmutableSlice};
|
use slice::{ImmutableEqSlice, ImmutableSlice};
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ use iter::{DoubleEndedIterator, AdditiveIterator, Extendable, Iterator, Map};
|
||||||
use option::{Option, None, Some};
|
use option::{Option, None, Some};
|
||||||
use str::Str;
|
use str::Str;
|
||||||
use str;
|
use str;
|
||||||
use slice::{CloneableVector, Splits, Vector, VectorVector,
|
use slice::{CloneableVector, Splits, Slice, VectorVector,
|
||||||
ImmutableEqSlice, ImmutableSlice};
|
ImmutableEqSlice, ImmutableSlice};
|
||||||
use vec::Vec;
|
use vec::Vec;
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ impl Path {
|
||||||
|
|
||||||
/// Returns a normalized byte vector representation of a path, by removing all empty
|
/// Returns a normalized byte vector representation of a path, by removing all empty
|
||||||
/// components, and unnecessary . and .. components.
|
/// components, and unnecessary . and .. components.
|
||||||
fn normalize<V: Vector<u8>+CloneableVector<u8>>(v: V) -> Vec<u8> {
|
fn normalize<V: Slice<u8>+CloneableVector<u8>>(v: V) -> Vec<u8> {
|
||||||
// borrowck is being very picky
|
// borrowck is being very picky
|
||||||
let val = {
|
let val = {
|
||||||
let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == SEP_BYTE;
|
let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == SEP_BYTE;
|
||||||
|
|
|
@ -23,7 +23,7 @@ use io::Writer;
|
||||||
use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Iterator, Map};
|
use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Iterator, Map};
|
||||||
use mem;
|
use mem;
|
||||||
use option::{Option, Some, None};
|
use option::{Option, Some, None};
|
||||||
use slice::{Vector, ImmutableSlice};
|
use slice::{Slice, ImmutableSlice};
|
||||||
use str::{CharSplits, Str, StrAllocating, StrVector, StrSlice};
|
use str::{CharSplits, Str, StrAllocating, StrVector, StrSlice};
|
||||||
use string::String;
|
use string::String;
|
||||||
use unicode::char::UnicodeChar;
|
use unicode::char::UnicodeChar;
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
#[doc(no_inline)] pub use slice::{MutableCloneableSlice, MutableOrdSlice};
|
#[doc(no_inline)] pub use slice::{MutableCloneableSlice, MutableOrdSlice};
|
||||||
#[doc(no_inline)] pub use slice::{ImmutableSlice, MutableSlice};
|
#[doc(no_inline)] pub use slice::{ImmutableSlice, MutableSlice};
|
||||||
#[doc(no_inline)] pub use slice::{ImmutableEqSlice, ImmutableOrdSlice};
|
#[doc(no_inline)] pub use slice::{ImmutableEqSlice, ImmutableOrdSlice};
|
||||||
#[doc(no_inline)] pub use slice::{Vector, VectorVector};
|
#[doc(no_inline)] pub use slice::{Slice, VectorVector};
|
||||||
#[doc(no_inline)] pub use slice::MutableSliceAllocating;
|
#[doc(no_inline)] pub use slice::MutableSliceAllocating;
|
||||||
#[doc(no_inline)] pub use string::String;
|
#[doc(no_inline)] pub use string::String;
|
||||||
#[doc(no_inline)] pub use vec::Vec;
|
#[doc(no_inline)] pub use vec::Vec;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue