Function proptest::string::bytes_regex
source · pub fn bytes_regex(
regex: &str,
) -> Result<RegexGeneratorStrategy<Vec<u8>>, Error>
Expand description
Creates a strategy which generates byte strings matching the given regular expression.
By default, the byte strings generated by this strategy will be valid
UTF-8. If you wish to generate byte strings that aren’t (necessarily)
valid UTF-8, wrap your regex (or some subsection of it) in (?-u: ... )
.
You may want to turn on the s
flag as well ((?s-u: ... )
) so that .
will generate newline characters (byte value 0x0A
). See the
regex
crate’s documentation
for more information.