about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorAndrew Poelstra <apoelstra@wpsoftware.net>2014-07-30 19:35:32 -0700
committerAndrew Poelstra <apoelstra@wpsoftware.net>2014-07-31 21:41:19 -0700
commit5bd8edc1121a5736994d69b2dc9cf3efb6fbc116 (patch)
tree6f465585ab0d0ef8bc4555f912d280df2e5245b1 /src/liballoc
parentb495933a7fdc5e7b28ddbb058d1e2dab330ace7b (diff)
downloadrust-5bd8edc1121a5736994d69b2dc9cf3efb6fbc116.tar.gz
rust-5bd8edc1121a5736994d69b2dc9cf3efb6fbc116.zip
libserialize: add `error()` to `Decoder`
A quick and dirty fix for #15036 until we get serious decoder reform.

Right now it is impossible for a Decodable to signal a decode error,
for example if it has only finitely many allowed values, is a string
which must be encoded a certain way, needs a valid checksum, etc. For
example in the libuuid implementation of Decodable an Option is
unwrapped, meaning that a decode of a malformed UUID will cause the
task to fail.

Since this adds a method to the `Decoder` trait, all users will need
to update their implementations to add it. The strategy used for the
current implementations for JSON and EBML is to add a new entry to
the error enum `ApplicationError(String)` which stores the string
provided to `.error()`.

[breaking-change]
Diffstat (limited to 'src/liballoc')
0 files changed, 0 insertions, 0 deletions