Comments (6)
The Eof
variant was never used in the current code and should have been removed long ago. The Error enum should be improved somehow probably it should be more like serde_json::Error
. Thanks for reporting this!
from cbor.
Hmm. Then I'd like to know if EOF in data can cause only the Io(Custom(EOF))
or something else too. Because I wrote a crate to deserialize CBOR from a network stream (tokio-serde-cbor) and some way to detect if I have enough data to decode a βframeβ is needed.
(The serde_json::Error
has is_eof
for that purpose)
from cbor.
All io errors are preserved in Error::Io
. The std::io::Error
has a method kind
to get the kind and then test for a UnexpectedEof
error.
from cbor.
Yes, I already handle that one.
I was asking if an EOF in input can cause another error I'd need to handle. Currently I do this:
https://github.com/vorner/tokio-serde-cbor/blob/master/src/lib.rs#L95
I thought the IO error handling is a temporary workaround, but now it seems like it is going to stay there. So I would like to be sure there's no other branch I need to add.
from cbor.
Yes IO error handling is (probably) here to stay. Would you prefer if I adapted the error type from serde_json for serde_cbor?
from cbor.
The serd_json
way is nice, clean and convenient.
However, I didn't really ask for any particular code or API changes. I just wanted to know if what I do is correct/enough or if I should handle some other case as well O:-).
from cbor.
Related Issues (20)
- Looking for Maintainers HOT 37
- Allow lossless number type conversion HOT 2
- Skip unwanted data using IgnoredAny HOT 2
- Integers don't get converted to float in tagged unions HOT 1
- Incorrect behavior for Option<()>
- Add support for stringref extension
- Packed encoding of enum still includes variant names for non-unit variants HOT 1
- Please provide to_writer_packed helper
- Compilation is very slow, especially for release builds HOT 1
- CI jobs seem to fail because of rustfmt problems is already-existing code HOT 2
- Fails to deserialize f64 inside tagged enum HOT 1
- Deserialization of enum variants only accepts fixed length map HOT 1
- Deserialisation of maps does not parse string keys to integers
- support serde_if_integer128! macro
- Why are tags feature-gated? HOT 3
- Question: 0xff as padding HOT 6
- Untagged enum with one named field doesn't round-trip
- RecursionLimitExceeded HOT 1
- Support BigFloat
- Update link to RFC in readme
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cbor.