Module serde_v2::de[][src]

Serde deserializer for stratum v2 implemented following serde tutorial

Possible implementation of an Sv2 deserializer from and io stream are:

  1. io stream -> read -> 'de buffer -> borrow -> 'de deserialized
  2. io stream -> read -> 'de buffer -> take ownership -> 'a deserialized
  3. io stream -> read -> take ownership -> 'a deserialized

The chosen implementation is (2) becasue:

  • Implementing a pareser for a byte slice is easyer than implementing a parser for a reader and number of copyes are the same.
  • Let the deserialized struct live longer than the initial buffer give more freedom for the same number of copyes.

Deserializer impl from_reader where Sv2 frames are read and copied in Deserializer. Each Deserializer contains a single Sv2 frame. Parsing a deserializer it never copy so we can define deserializer in Sv2 messaged rapresented by struct of borrowed data that had the same lifetime of Deserializer without copying any data.

Structs

Deserializer

Functions

from_bytes