(buffer: &mut Vec<u8>, string: &str, count: usize)
| 271 | // count must be > 0 |
| 272 | #[inline] |
| 273 | fn repeat_to_buffer(buffer: &mut Vec<u8>, string: &str, count: usize) { |
| 274 | buffer.clear(); |
| 275 | if !string.is_empty() { |
| 276 | let src = string.as_bytes(); |
| 277 | // Initial copy |
| 278 | buffer.extend_from_slice(src); |
| 279 | // Doubling strategy: copy what we have so far until we reach the target |
| 280 | while buffer.len() < src.len() * count { |
| 281 | let copy_len = buffer.len().min(src.len() * count - buffer.len()); |
| 282 | // SAFETY: we're copying valid UTF-8 bytes that we already verified |
| 283 | buffer.extend_from_within(..copy_len); |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | // Output is null IFF either input is null |
| 289 | let nulls = NullBuffer::union(string_array.nulls(), number_array.nulls()); |
no test coverage detected
searching dependent graphs…