Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1350,15 +1350,17 @@ impl<Item, const INLINE: usize, Heap: Allocator> SmallVec<Item, INLINE, Heap> {
}
}

pub const fn new_in(allocator: Heap) -> SmallVec<Item, INLINE, Heap> {
#[cfg_attr(feature = "allocator-api", syntax(pub))]
const fn new_in(allocator: Heap) -> SmallVec<Item, INLINE, Heap> {
Self {
length: LocatedLength::new(0, false),
raw: RawSmallVec::new(),
allocator
}
}

pub fn try_with_capacity_in(capacity: usize, allocator: Heap) -> Result<Self, SmallVecError> {
#[cfg_attr(feature = "allocator-api", syntax(pub))]
fn try_with_capacity_in(capacity: usize, allocator: Heap) -> Result<Self, SmallVecError> {
let mut this = Self::new_in(allocator);
if capacity > Self::inline_size() && !Self::IS_ZST {
// SAFETY: we checked all the preconditions
Expand All @@ -1373,7 +1375,8 @@ impl<Item, const INLINE: usize, Heap: Allocator> SmallVec<Item, INLINE, Heap> {
Ok(this)
}

pub fn with_capacity_in(capacity: usize, allocator: Heap) -> Self {
#[cfg_attr(feature = "allocator-api", syntax(pub))]
fn with_capacity_in(capacity: usize, allocator: Heap) -> Self {
Self::try_with_capacity_in(capacity, allocator).unwrap_or_else(SmallVecError::handle)
}
}
Expand Down
Loading