fn insert_new_content(
    rng: &mut RngType,
    buf: &mut Vec<u8>,
    r: RangeInclusive<u64>,
    mut modify: impl FnMut(&mut RngType, &mut u8),
) -> bool {
    let max_len = (*r.end() as usize).saturating_sub(buf.len());
    if max_len < 2 {
        return false;
    }
    let len = rand_op_len(rng, max_len);
    let start = rng.gen_range(0..=buf.len());
    let prev_end = buf.len();
    buf.reserve(len);
    unsafe { buf.set_len(len + prev_end) };
    buf.copy_within(start..prev_end, start + len);
    for i in &mut buf[start..start + len] {
        modify(rng, i);
    }
    true
}
/// Inserts content by generating new bytes.
Inserts content by generating new bytes.
Inserts content by generating new bytes .
fn insert_new_content(
    rng: &mut RngType,
    buf: &mut Vec<u8>,
    r: RangeInclusive<u64>,
    mut modify: impl FnMut(&mut RngType, &mut u8),
) -> bool {
    let max_len = (*r.end() as usize).saturating_sub(buf.len());
    if max_len < 2 {
        return false;
    }
    let len = rand_op_len(rng, max_len);
    let start = rng.gen_range(0..=buf.len());
    let prev_end = buf.len();
    buf.reserve(len);
    unsafe { buf.set_len(len + prev_end) };
    buf.copy_within(start..prev_end, start + len);
    for i in &mut buf[start..start + len] {
        modify(rng, i);
    }
    true
}
fn insert_new_content ( rng : & mut RngType , buf : & mut Vec < u8 > , r : RangeInclusive < u64 > , mut modify : impl FnMut ( & mut RngType , & mut u8 ) , ) -> bool { let max_len = ( * r . end ( ) as usize ) . saturating_sub ( buf . len ( ) ) ; if max_len < 2 { return false ; } let len = rand_op_len ( rng , max_len ) ; let start = rng . gen_range ( 0 ..= buf . len ( ) ) ; let prev_end = buf . len ( ) ; buf . reserve ( len ) ; unsafe { buf . set_len ( len + prev_end ) } ; buf . copy_within ( start .. prev_end , start + len ) ; for i in & mut buf [ start .. start + len ] { modify ( rng , i ) ; } true }
Inserts content by generating new bytes.
Inserts content by generating new bytes .
rng
&mut RngType
buf
&mut Vec<u8>
r
RangeInclusive<u64>
modify
impl FnMut(&mut RngType, &mut u8)
rng
&mut RngType
buf
&mut Vec<u8>
r
RangeInclusive<u64>
modify
impl FnMut(&mut RngType, &mut u8)