mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
[misc] Helper functions to ObjectPool
This commit is contained in:
@@ -146,6 +146,14 @@ pub fn ObjectPool(
|
||||
unreachable;
|
||||
}
|
||||
|
||||
pub fn full() bool {
|
||||
if (comptime max_count == 0) return false;
|
||||
return data().loaded and data().count >= max_count;
|
||||
}
|
||||
|
||||
pub fn has() bool {
|
||||
return data().loaded and data().list.first != null;
|
||||
}
|
||||
pub fn get(allocator: std.mem.Allocator) *LinkedList.Node {
|
||||
if (data().loaded) {
|
||||
if (data().list.popFirst()) |node| {
|
||||
|
||||
Reference in New Issue
Block a user