niceware icon indicating copy to clipboard operation
niceware copied to clipboard

Consider exposing word from `UnknownWordError`

Open Kixunil opened this issue 3 years ago • 0 comments

Inspecting specific word that is unknown may be useful to some callers but adding a method to retrieve it basically commits to always storing it within error type. I think it's very reasonable to expect that it will always be there but opened an issue just in case. The suggested method is:

/// The word that is not known
fn word(&self) -> &str {
    &self.word
}

An alternative would be to continue scanning the words even after error and return a slice of all unknown words.

Kixunil avatar Oct 10 '21 14:10 Kixunil