pub fn mutate_buffer_string(ctx: &mut Context, rng: &mut RngType, val: &mut Value) -> bool {
    let ty = val.ty(ctx.target()).checked_as_buffer_string();
    let r = if !ty.varlen() && ty.size() != 0 {
        ty.size()..=ty.size()
    } else {
        0..=MAX_BLOB_LEN
    };

    if ty.is_glob() {
        let new_val = if !ty.vals().is_empty() {
            gen_buffer_string(ctx, rng, val.ty(ctx.target), val.dir())
        } else {
            let filename = rand_filename(ctx, rng, val.ty(ctx.target), ty.noz());
            DataValue::new(val.ty_id(), val.dir(), filename).into()
        };
        debug_info!(
            "mutate_buffer_string(glob): {}",
            display_value_diff(val, &new_val, ctx.target)
        );
        *val = new_val;
        return true;
    }

    let val = val.checked_as_data_mut();
    if val.dir() == Dir::Out {
        let new_size = mutate_blob_len(rng, val.size, r);
        let mutated = new_size != val.size;
        debug_info!("mutate_buffer_string(size): {} -> {}", val.size, new_size);
        val.size = new_size;
        mutated
    } else if !ty.vals().is_empty() {
        let new_val = ty.vals().choose(rng).unwrap().to_vec();
        let mutated = new_val != val.data;
        debug_info!(
            "mutate_buffer_string(vals): {} -> {}",
            new_val.len(),
            val.data.len()
        );
        val.data = new_val;
        mutated
    } else {
        do_mutate_blob(ctx, rng, &mut val.data, r)
    }
}
/// Mutate a buffer string value.
Mutate a buffer string value.
Mutate a buffer string value .
pub fn mutate_buffer_string(ctx: &mut Context, rng: &mut RngType, val: &mut Value) -> bool {
    let ty = val.ty(ctx.target()).checked_as_buffer_string();
    let r = if !ty.varlen() && ty.size() != 0 {
        ty.size()..=ty.size()
    } else {
        0..=MAX_BLOB_LEN
    };
    if ty.is_glob() {
        let new_val = if !ty.vals().is_empty() {
            gen_buffer_string(ctx, rng, val.ty(ctx.target), val.dir())
        } else {
            let filename = rand_filename(ctx, rng, val.ty(ctx.target), ty.noz());
            DataValue::new(val.ty_id(), val.dir(), filename).into()
        };
        debug_info!(
            "mutate_buffer_string(glob): {}",
            display_value_diff(val, &new_val, ctx.target)
        );
        *val = new_val;
        return true;
    }
    let val = val.checked_as_data_mut();
    if val.dir() == Dir::Out {
        let new_size = mutate_blob_len(rng, val.size, r);
        let mutated = new_size != val.size;
        debug_info!("mutate_buffer_string(size): {} -> {}", val.size, new_size);
        val.size = new_size;
        mutated
    } else if !ty.vals().is_empty() {
        let new_val = ty.vals().choose(rng).unwrap().to_vec();
        let mutated = new_val != val.data;
        debug_info!(
            "mutate_buffer_string(vals): {} -> {}",
            new_val.len(),
            val.data.len()
        );
        val.data = new_val;
        mutated
    } else {
        do_mutate_blob(ctx, rng, &mut val.data, r)
    }
}
pub fn mutate_buffer_string ( ctx : & mut Context , rng : & mut RngType , val : & mut Value ) -> bool { let ty = val . ty ( ctx . target ( ) ) . checked_as_buffer_string ( ) ; let r = if ! ty . varlen ( ) && ty . size ( ) != 0 { ty . size ( ) ..= ty . size ( ) } else { 0 ..= MAX_BLOB_LEN } ; if ty . is_glob ( ) { let new_val = if ! ty . vals ( ) . is_empty ( ) { gen_buffer_string ( ctx , rng , val . ty ( ctx . target ) , val . dir ( ) ) } else { let filename = rand_filename ( ctx , rng , val . ty ( ctx . target ) , ty . noz ( ) ) ; DataValue :: new ( val . ty_id ( ) , val . dir ( ) , filename ) . into ( ) } ; debug_info ! ( " " display_value_diff ( val new_val ctx target ) ) ; * val = new_val ; return true ; } let val = val . checked_as_data_mut ( ) ; if val . dir ( ) == Dir :: Out { let new_size = mutate_blob_len ( rng , val . size , r ) ; let mutated = new_size != val . size ; debug_info ! ( " " val size new_size ) ; val . size = new_size ; mutated } else if ! ty . vals ( ) . is_empty ( ) { let new_val = ty . vals ( ) . choose ( rng ) . unwrap ( ) . to_vec ( ) ; let mutated = new_val != val . data ; debug_info ! ( " " new_val len ( ) val data len ( ) ) ; val . data = new_val ; mutated } else { do_mutate_blob ( ctx , rng , & mut val . data , r ) } }
Mutate a buffer string value.
Mutate a buffer string value .
ctx
&mut Context
rng
&mut RngType
val
&mut Value
ctx
&mut Context
rng
&mut RngType
val
&mut Value