From 18e38104ce60a02f27b565097cff66c3429aa8d4 Mon Sep 17 00:00:00 2001 From: Matthias Portzel Date: Sun, 23 Aug 2026 17:14:19 -0500 Subject: [PATCH] Re-add deprecated getLast and getLastOrNull --- lib/std/array_list.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 23a9573a3fa4a05aadd61516ea0f45eeb2212903..6e9a3d528660db3d2c202ef84146f46db32ee444 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -544,6 +544,11 @@ pub fn AlignedManaged(comptime T: type, comptime alignment: ?mem.Alignment) type return self.allocatedSlice()[self.items.len..]; } + /// Deprecated + pub fn getLast(self: Self) T { + return self.items[self.items.len - 1]; + } + /// Deprecated in favor of `last` pub const getLastOrNull = last; @@ -1399,6 +1404,14 @@ pub fn Aligned(comptime T: type, comptime alignment: ?mem.Alignment) type { return self.allocatedSlice()[self.items.len..]; } + /// Deprecated + pub fn getLast(self: Self) T { + return self.items[self.items.len - 1]; + } + + /// Deprecated in favor of `last` + pub const getLastOrNull = last; + /// Returns the last element from the list, or `null` if the list is /// empty. pub fn last(self: Self) ?T { -- 2.54.0