Commit Graph

13 Commits

Author SHA1 Message Date
Taylor Yu
2dc93cadda fix(from_str, try_from_into): custom error types
Remove the use of trait objects as errors from `from_str` and
`try_from_into`; they seem to have caused a lot of confusion in
practice. (Also, it's considered best practice to use custom error
types instead of boxed errors in library code.) Instead, use custom
error enums, and update hints accordingly. Hints also provide
some guidance about converting errors, which could be covered
more completely in a future advanced errors section.

Also move from_str to directly after the similar exercise `from_into`,
for the sake of familiarity when solving.
2021-06-24 21:33:41 -05:00
Taylor Yu
2e93a588e0 fix: use trait objects for try_from_into
Use `Box<dyn error::Error>` to allow solutions to use `?` to propagate
errors.  In the tests, explicitly check `is_ok()` instead of trying to
force the error type to `String` (or other `PartialEq` type) using
`assert_eq!()`.
2021-04-04 12:41:32 -05:00
Christos Kontas
04f1d079aa feat(try_from_into): remove duplicate annotation 2020-12-03 17:51:30 +01:00
Wei Hu
4f4cfcf3c3 fix(try_from_into): type error 2020-11-11 21:02:00 -08:00
JP
96347df9df
fix(try_from_into): Update description (#584)
Description update
2020-11-08 19:30:40 +01:00
fiplox
95ccd92616
feat(try_from_into): Add tests (#571)
Co-authored-by: Volodymyr Patuta <6977238-fiplox@users.noreply.gitlab.com>
2020-11-07 14:01:39 +01:00
Étienne Barrié
3144d3ae63 chore: Run rustfmt on exercises 2020-08-10 10:24:21 -04:00
Chad Dougherty
523d18b873
feat(try_from_into): Add insufficient length test (#469) 2020-07-13 11:39:05 +02:00
IkaR49
763aa6e378
feat: Rewrite try_from_into (#393) 2020-05-15 23:02:57 +02:00
apatniv
41f989135d Review Comments: Add other test cases 2020-05-02 20:41:11 -04:00
lebedevsergey
c9e4f2cfb4
fix: confusing comment in conversions/try_from_into.rs
Co-authored-by: Lebedev <sergey.lebedev@corp.mail.ru>
2020-04-17 15:43:01 +02:00
Abdou Seck
fc26b5e151 I AM NOT DONE comment in conversions exercise files 2019-12-16 11:33:00 -05:00
Abdou Seck
0c85dc1193 feat: Add type conversion and parsing exercises 2019-12-16 09:12:13 -05:00