1
Fork 0

Rename CollectionAllocError to TryReserveError

This commit is contained in:
Simon Sapin 2019-06-12 20:02:01 +02:00
parent 9dd5c19199
commit 36b18a1901
11 changed files with 45 additions and 45 deletions

View file

@ -70,7 +70,7 @@ use core::ptr::{self, NonNull};
use core::slice::{self, SliceIndex};
use crate::borrow::{ToOwned, Cow};
use crate::collections::CollectionAllocErr;
use crate::collections::TryReserveError;
use crate::boxed::Box;
use crate::raw_vec::RawVec;
@ -498,9 +498,9 @@ impl<T> Vec<T> {
///
/// ```
/// #![feature(try_reserve)]
/// use std::collections::CollectionAllocErr;
/// use std::collections::TryReserveError;
///
/// fn process_data(data: &[u32]) -> Result<Vec<u32>, CollectionAllocErr> {
/// fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {
/// let mut output = Vec::new();
///
/// // Pre-reserve the memory, exiting if we can't
@ -516,7 +516,7 @@ impl<T> Vec<T> {
/// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
/// ```
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.buf.try_reserve(self.len, additional)
}
@ -538,9 +538,9 @@ impl<T> Vec<T> {
///
/// ```
/// #![feature(try_reserve)]
/// use std::collections::CollectionAllocErr;
/// use std::collections::TryReserveError;
///
/// fn process_data(data: &[u32]) -> Result<Vec<u32>, CollectionAllocErr> {
/// fn process_data(data: &[u32]) -> Result<Vec<u32>, TryReserveError> {
/// let mut output = Vec::new();
///
/// // Pre-reserve the memory, exiting if we can't
@ -556,7 +556,7 @@ impl<T> Vec<T> {
/// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
/// ```
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.buf.try_reserve_exact(self.len, additional)
}