mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
docs: Remove subjective claims from zero() method documentation
Focus on what the function does rather than why it should be used. Remove context-dependent claims about efficiency, security, and use cases.
This commit is contained in:
@@ -605,17 +605,9 @@ pub fn MultiArrayList(comptime T: type) type {
|
||||
|
||||
/// Zero-initialize all allocated memory in the MultiArrayList.
|
||||
///
|
||||
/// This method efficiently clears the entire backing buffer by setting all bytes to zero,
|
||||
/// which zero-initializes all fields across all elements in the list. This is more
|
||||
/// efficient than iterating through individual elements or fields.
|
||||
///
|
||||
/// Use cases:
|
||||
/// - Security: Clear sensitive data from memory
|
||||
/// - Deterministic behavior: Ensure uninitialized memory doesn't contain garbage
|
||||
/// - Testing: Create predictable initial states
|
||||
///
|
||||
/// Note: This operation affects the entire allocated capacity, not just the current length.
|
||||
/// All reserved but unused capacity will also be zeroed.
|
||||
/// Sets all bytes in the backing buffer to zero, which zero-initializes all fields
|
||||
/// across all elements in the list. This operation affects the entire allocated
|
||||
/// capacity, not just the current length.
|
||||
pub fn zero(self: Self) void {
|
||||
@memset(self.allocatedBytes(), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user