Struct CharStrategy
struct CharStrategy<'a> { ... }
Strategy for generating chars.
Character selection is more sophisticated than integer selection. Naïve
selection (particularly in the larger context of generating strings) would
result in starting inputs like ꂡ螧轎ቶᢹ糦狥芹ᘆ㶏曊ᒀ踔虙ჲ and "simplified"
inputs consisting mostly of control characters. It also has difficulty
locating edge cases, since the vast majority of code points (such as the
enormous CJK regions) don't cause problems for anything with even basic
Unicode support.
Instead, character selection is always based on explicit ranges, and is designed to bias to specifically chosen characters and character ranges to produce inputs that are both more useful and easier for humans to understand. There are also hard-wired simplification targets based on ASCII instead of simply simplifying towards NUL to avoid problematic inputs being reduced to a bunch of NUL characters.
Shrinking never crosses ranges. If you have a complex range like [A-Za-z]
and the starting point x is chosen, it will not shrink to the first A-Z
group, but rather simply to a.
The usual way to get instances of this class is with the module-level ANY
constant or range function. Directly constructing a CharStrategy is
only necessary for complex ranges or to override the default biases.
Implementations
impl<'a> CharStrategy<'a>
fn new(special: Cow<'a, [char]>, preferred: Cow<'a, [core::ops::RangeInclusive<char>]>, ranges: Cow<'a, [core::ops::RangeInclusive<char>]>) -> SelfConstruct a new
CharStrategywith the parameters it will pass to the function underlyingselect_char().All arguments as per
select_char().fn new_borrowed(special: &'a [char], preferred: &'a [core::ops::RangeInclusive<char>], ranges: &'a [core::ops::RangeInclusive<char>]) -> SelfSame as
CharStrategy::new()but usingCow::Borrowedfor all parts.
impl<'a> Clone for CharStrategy<'a>
fn clone(self: &Self) -> CharStrategy<'a>
impl<'a> Debug for CharStrategy<'a>
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl<'a> Freeze for CharStrategy<'a>
impl<'a> RefUnwindSafe for CharStrategy<'a>
impl<'a> Send for CharStrategy<'a>
impl<'a> Strategy for CharStrategy<'a>
fn new_tree(self: &Self, runner: &mut TestRunner) -> NewTree<Self>
impl<'a> Sync for CharStrategy<'a>
impl<'a> Unpin for CharStrategy<'a>
impl<'a> UnwindSafe for CharStrategy<'a>
impl<T> Any for CharStrategy<'a>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for CharStrategy<'a>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for CharStrategy<'a>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for CharStrategy<'a>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for CharStrategy<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for CharStrategy<'a>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for CharStrategy<'a>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for CharStrategy<'a>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for CharStrategy<'a>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip for CharStrategy<'a>
fn vzip(self: Self) -> V