Giter VIP home page Giter VIP logo

Comments (6)

pyfisch avatar pyfisch commented on July 3, 2024

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.

vorner avatar vorner commented on July 3, 2024

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.

pyfisch avatar pyfisch commented on July 3, 2024

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 UnexpectedEoferror.

from cbor.

vorner avatar vorner commented on July 3, 2024

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.

pyfisch avatar pyfisch commented on July 3, 2024

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.

vorner avatar vorner commented on July 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.