Crate string_generator [] [src]

Provides ways of creating random strings from patterns.



Error type for string generation. empty contains any catagories that contained no variants, and so therefore had no effect on the generated string; failed contains any catagories that were requested by the pattern but did not exist in the catagories hashmap; attempt contains what the program could construct ignoring any errors. It should be noted, that if any error occurs, there will be null characters (U+0000) present in the string.



Generate a string from a set of catagories, a pattern, and a random number generator. The patterns are scanned through one at a time, then used to pull a slice out of the hashmap. An entry from this is then reandomly selected, and turned into a character. These are all combined into a string and returned. Should an error occur, an instance of GenStringError will be returned.