|
|
|
|
|
by marcosdumay
811 days ago
|
|
It's best if your parser fails. Serde has an interface that allows failing. That one should fail. There is also another that panics, and AFAIK it will automatically panic on any parser that fails. Do not try to handle huge values, do not pretend your parser is total, and do not pretend it's a correct value. If you want to create an specialized parser that handles huge numbers, that's great. But any general one must fail on them. |
|
[EDIT]: Oh I see, fix the parser to disallow such large numbers from entering the system in the first place, then you don't have to worry about adding them together. Yeah that could be a good first step towards safety. Though, I don't know how to parametrize the serde call.