Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

Support for shrinking/growing Vec<T> #5

@landaire

Description

@landaire

When calling Mutatable::mutate on an object that contains a Vec, the current impl Mutatable<T> for Vec<T> will treat itself as a slice and mutate all objects in-place. Shrinking/growing the Vec is desirable and should, for a baseline, require the following work:

  1. Fix mutate methods not passing down Constraints.
  2. Add two new impls:
impl<T> Mutatable for Vec<T>
where
    T: Mutatable

Where only shrinking a Vec would be performed

and:

impl<T> Mutatable for Vec<T>
where
    T: Mutatable + NewFuzzed + SerializedSize

Where shrinking or growing a Vec would be performed. The separation here allows us to call NewFuzzed::new_fuzzed() on the new elements in the vec, while also respecting the max size constraint if it's provided.

Another desired feature would be to randomly mutate fields or slice elements to be the length of any known vectors in the data structure (including encapsulating structures), but this is a pretty large undertaking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions