1
Fork 0

Migrate all users of opt_vec to owned_slice, delete opt_vec.

syntax::opt_vec is now entirely unused, and so can go.
This commit is contained in:
Huon Wilson 2014-03-20 01:52:37 +11:00
parent 0384952a65
commit e33676b793
35 changed files with 162 additions and 340 deletions

View file

@ -121,6 +121,19 @@ impl<T> Vec<T> {
}
}
/// Create a `Vec<T>` directly from the raw constituents.
///
/// This is highly unsafe:
///
/// - if `ptr` is null, then `length` and `capacity` should be 0
/// - `ptr` must point to an allocation of size `capacity`
/// - there must be `length` valid instances of type `T` at the
/// beginning of that allocation
/// - `ptr` must be allocated by the default `Vec` allocator
pub unsafe fn from_raw_parts(length: uint, capacity: uint, ptr: *mut T) -> Vec<T> {
Vec { len: length, cap: capacity, ptr: ptr }
}
/// Consumes the `Vec`, partitioning it based on a predcate.
///
/// Partitions the `Vec` into two `Vec`s `(A,B)`, where all elements of `A`