mirror of
https://codeberg.org/kaasboteram/zig-iterating.git
synced 2025-12-15 09:43:14 +01:00
Add size hint for Once
This commit is contained in:
parent
5dc6daf2eb
commit
d91cb914bd
1 changed files with 4 additions and 0 deletions
|
|
@ -378,6 +378,10 @@ pub fn Once(comptime T: type) type {
|
|||
defer self.value = null;
|
||||
return self.value;
|
||||
}
|
||||
|
||||
pub fn sizeHint(self: *const Self) usize {
|
||||
return @intFromBool(self.value != null);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue