authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-09-13 19:32:52-07:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-18 12:47:18+02:00
log72017d4bd5f69eb243053a76227753b69bdf6b56
tree90294bdddf94aba8e0a0b6edfda8d3c7f0b52fe4
parent35de86906dad5e0d0794cd0c834d00355382e9b5
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

mem.replace: Document that input/output cannot overlap


1 files changed, 1 insertions(+), 0 deletions(-)

lib/std/mem.zig+1
...@@ -3785,6 +3785,7 @@ test rotate {...@@ -3785,6 +3785,7 @@ test rotate {
37853785
3786/// Replace needle with replacement as many times as possible, writing to an output buffer which is assumed to be of3786/// Replace needle with replacement as many times as possible, writing to an output buffer which is assumed to be of
3787/// appropriate size. Use replacementSize to calculate an appropriate buffer size.3787/// appropriate size. Use replacementSize to calculate an appropriate buffer size.
3788/// The `input` and `output` slices must not overlap.
3788/// The needle must not be empty.3789/// The needle must not be empty.
3789/// Returns the number of replacements made.3790/// Returns the number of replacements made.
3790pub fn replace(comptime T: type, input: []const T, needle: []const T, replacement: []const T, output: []T) usize {3791pub fn replace(comptime T: type, input: []const T, needle: []const T, replacement: []const T, output: []T) usize {