allocgate: std Allocator interface refactor
This commit is contained in:
@@ -21,10 +21,10 @@ pub fn PriorityDequeue(comptime T: type, comptime compareFn: fn (T, T) Order) ty
|
||||
|
||||
items: []T,
|
||||
len: usize,
|
||||
allocator: *Allocator,
|
||||
allocator: Allocator,
|
||||
|
||||
/// Initialize and return a new priority dequeue.
|
||||
pub fn init(allocator: *Allocator) Self {
|
||||
pub fn init(allocator: Allocator) Self {
|
||||
return Self{
|
||||
.items = &[_]T{},
|
||||
.len = 0,
|
||||
@@ -336,7 +336,7 @@ pub fn PriorityDequeue(comptime T: type, comptime compareFn: fn (T, T) Order) ty
|
||||
/// Dequeue takes ownership of the passed in slice. The slice must have been
|
||||
/// allocated with `allocator`.
|
||||
/// De-initialize with `deinit`.
|
||||
pub fn fromOwnedSlice(allocator: *Allocator, items: []T) Self {
|
||||
pub fn fromOwnedSlice(allocator: Allocator, items: []T) Self {
|
||||
var queue = Self{
|
||||
.items = items,
|
||||
.len = items.len,
|
||||
@@ -945,7 +945,7 @@ fn fuzzTestMinMax(rng: std.rand.Random, queue_size: usize) !void {
|
||||
}
|
||||
}
|
||||
|
||||
fn generateRandomSlice(allocator: *std.mem.Allocator, rng: std.rand.Random, size: usize) ![]u32 {
|
||||
fn generateRandomSlice(allocator: std.mem.Allocator, rng: std.rand.Random, size: usize) ![]u32 {
|
||||
var array = std.ArrayList(u32).init(allocator);
|
||||
try array.ensureTotalCapacity(size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user