Coder Social home page Coder Social logo

tokio-serde-cbor's People

Contributors

iamkroot avatar najamelan avatar vorner avatar vskh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tene najamelan vskh

tokio-serde-cbor's Issues

Codec, Decoder, and Encoder are !Send + !Sync

Because Decoder and Encoder contain a PhantomData<*const Item> field, all three structs are !Send + !Sync. This prevents any of them from being used with a thread pool. Shouldn't the phantom data just be PhantomData<Item>? Neither the encoder nor the decoder have an internal state, as they simply read whole items from or write whole items to a buffer provided by the caller.

How do I use this codec?

Hi,

I'm trying to use this for ipc, but I can't get it to work, and found no examples or doc, or unit tests that show how this works with tokio streams... I can't figure out how I should use this. The code almost identical works with a LinesCodec (without using serde, just sending strings).

This is what I got: https://github.com/najamelan/test_uds_tokio/blob/DecodeError/src/libpeers/ipc_peer.rs

Basically the codec gets setup in the new method.
The reading happens in the listening method.
The writing happens in the Handler impl.
IpcMessage is a simple struct that derives serde Serialize/Deserialize.

If you want to run it, use cargo run --bin peera. peerb.rs does the sending. peera.rs the receiving end.

I always get this error:

Error extracting IpcMessage from stream
Cbor(
    ErrorImpl {
        code: Message(
            "invalid type: byte array, expected struct IpcMessage"
        ),
        offset: 0
    }
)

Thanks in advance for your help.

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.