Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 message mod API improvements #439

Merged
merged 21 commits into from
Aug 16, 2023
Merged

Commits on Aug 14, 2023

  1. Configuration menu
    Copy the full SHA
    314e948 View commit details
    Browse the repository at this point in the history
  2. 🔥 zb: Drop message::Field::Invalid

    This variant is never constructed by us. When we encounter invalid field
    code, we throw an error.
    zeenix committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    2ef0d55 View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2023

  1. 🔥 zb: Drop unneeded From<u8> for message::FieldCode

    Seriously doubt anyone uses this and this will also allow us to drop
    `FieldCode::Invalid` in the following commit.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    546f061 View commit details
    Browse the repository at this point in the history
  2. 🔥 zb: Drop now unneeded message::FieldCode::Invalid

    A message with an invalid field code will just fail to deserialize so we
    don't need to represent this state.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    53cda6c View commit details
    Browse the repository at this point in the history
  3. 🔥 zb: Drop unneeded From<u8> for message::Type

    Seriously doubt anyone uses this and this will also allow us to drop
    `message::Type::Invalid` in the following commit.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    4c91b4e View commit details
    Browse the repository at this point in the history
  4. 🔥 zb: Drop now unneeded message::Type::Invalid

    An invalid message will just fail to deserialize so we don't need to
    represent this state.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    fb7c2a1 View commit details
    Browse the repository at this point in the history
  5. 🏗️ zb: Cache all message header fields

    We'll be using these to avoid having to deserialize header and individual
    fields repeatedly.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    793e4df View commit details
    Browse the repository at this point in the history
  6. ♻️ zb: Message::body_signature now infallible and more efficient

    As it is now based on the internal fields cache and doesn't involve
    deserializing the header.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    6d318a7 View commit details
    Browse the repository at this point in the history
  7. ⚡️ zb: Message::header doesn't deserialize anymore

    We now construct the Header from fields cache and primary header clone.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    8c45ee0 View commit details
    Browse the repository at this point in the history
  8. 🔥 zb: Drop Error::NoBodySignature variant

    This variant is never constructed anymore and hence useless.
    
    We could just deprecate it only but the chances of someone using this in
    client code are very low so let's not bother.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    e42584c View commit details
    Browse the repository at this point in the history
  9. ⚡️ zb: Message::fields doesn't deserialize anymore

    We now construct the fields from the cache.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    510f3d3 View commit details
    Browse the repository at this point in the history
  10. 📝 zb: Update docs about Message::{header, fields} being slow

    They are not anymore.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    539cab4 View commit details
    Browse the repository at this point in the history
  11. 🔥 zb: Message::fields now infallible

    Since we construct the fields from the cache.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    7fb2d50 View commit details
    Browse the repository at this point in the history
  12. 🔥 zb: Message::header now infallible

    Since we construct the header from the cache now.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    8aaca42 View commit details
    Browse the repository at this point in the history
  13. 🔥 zb: message::Header getters now infallible

    Since we either construct the header from the cache now or deserialize
    from raw bytes and the deserialization will fail if the message has
    fields with incorrect codes (the only possible issue here).
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    fb88092 View commit details
    Browse the repository at this point in the history
  14. 🔥 zb: Drop all use of direct field getters of Message

    They'll be deprecated in a following commit.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    bf17866 View commit details
    Browse the repository at this point in the history
  15. 🗑️ zb: Deprecate direct fields gettes of Message

    Not only is the performance of the direct fields getters no longer much
    worse than the getting the fields through the header, but also field
    getters on the header are much faster the that of Message.
    
    Moreover, I've ideas on how to make the header getter even faster.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    260db58 View commit details
    Browse the repository at this point in the history
  16. 🔥 zb: Drop message::Header::new() from public API

    I don't see users having much need for this and we're about to make
    `Field*` API private.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    303cfdc View commit details
    Browse the repository at this point in the history
  17. 🔥 zb: Drop message::Fields::into_field

    We don't need this method internally, doubt anyone uses it and we're
    about to turn Field* API private anyway.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    6d27d1e View commit details
    Browse the repository at this point in the history
  18. 🔥 zb: Drop message::Header::into_fields

    We don't need this method internally, doubt anyone uses it and we're
    about to turn Field* API private anyway.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    8b1376b View commit details
    Browse the repository at this point in the history
  19. 🔥 zb: message::Field* API now private

    This exposes way too much internal details about the protocol that users
    do not need. The specific field getters we provide are sufficient for
    any low-level code.
    
    I wrote most of this when I was still very new to Rust and I started
    with a very bottoms-up approach. Hence we these API had been public
    until now.
    
    I doubt anyone uses these anyway so chances of people's code breaking
    are low but even if they do, it's a API breaking release.
    zeenix committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    8db83bd View commit details
    Browse the repository at this point in the history