I recently completed https:/exercism.org/tracks/rust/exercises/rna-transcription, but couldn’t quite figure out what the error type in the signatures of DNA::new()
and RNA::new()
was supposed to mean from looking at the tests. Unfortunately, I interpreted it as “the number of different nucleotides used before encountering the first invalid char”, which just so happened to pass the test cases, even though it was wrong. (I can submit a separate PR for fixing up those test cases.)
It turns out though that the usize
in Result<Self, usize>
was meant to mean “the first invalid character index”: https:/exercism.org/tracks/rust/exercises/rna-transcription
I opened this PR that clarifies the meaning of the error value in the return type. Any chance a language track maintainer could give this a look?