decimal: replace homebuilt try_from with FromStr impl
Đang mở
- Ngôn ngữ chính
- Rust
- Star
- 1.8k
- Fork
- 548
- Merge trung bình
- 13 giờ 3 phút
- Pull request đã merge (30 ngày)
- 2
Mô tả
https://github.com/exercism/rust/blob/9ad579f44024e459656d9646df9e8f0b33a3af13/exercises/decimal/example.rs#L30
It's more idiomatic and expressive to `impl FromStr for Decimal` instead of using a custom parse method. This is very slightly harder for the students, but it makes usage much nicer:
```diff
- let decimal = Decimal.try_from("123.45")?;
+ let decimal: Decimal = "123.45".parse()?;
```
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.