const std = @import("std"); /// A nullable allocator the same size as `std.mem.Allocator`. pub const NullableAllocator = struct { ptr: *anyopaque = undefined, // Utilize the null pointer optimization on the vtable instead of // the regular ptr because some allocator implementations might tag their // `ptr` property. vtable: ?*const std.mem.Allocator.VTable = null, pub inline fn init(a: std.mem.Allocator) @This() { return .{ .ptr = a.ptr, .vtable = a.vtable, }; } pub inline fn isNull(this: @This()) bool { return this.vtable == null; } pub inline fn get(this: @This()) ?std.mem.Allocator { return if (this.vtable) |vt| std.mem.Allocator{ .ptr = this.ptr, .vtable = vt } else null; } }; comptime { if (@sizeOf(NullableAllocator) != @sizeOf(std.mem.Allocator)) { @compileError("Expected the sizes to be the same."); } } '>ansg191/server-identity-CN Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/builtins/cpp/WritableStreamDefaultWriterBuiltins.cpp (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-11-28Ensure we report errors in controller.closeGravatar Jarred Sumner 1-1/+9
2022-11-28Update JSEnvironmentVariableMap.cppGravatar Jarred Sumner 1-1/+1
2022-11-28Allow overriding node:fsGravatar Jarred Sumner 1-0/+9
2022-11-28Add test for processGravatar Jarred Sumner 1-3/+14
2022-11-28Fix process.env and Bun.env object spreadGravatar Jarred Sumner 8-204/+127
2022-11-27Fix `console.log(process.env)`Gravatar Jarred Sumner 2-20/+27