Skip to content

Conversation

@y86
Copy link

@y86 y86 commented Aug 25, 2023

Depends on #67
Closes #60
Enables the solution of #61 and #62

The goal of this PR is to introduce a way for users to override default implementations from the library, In order to achieve that, several changes were introduced:

  • Add options argument to Msgpax.Packer protocol #67 that allows options to be used to configure implementations;
  • Refactoring of how extensions are represented: instead of having one struct Msgpax.Ext, we have 128 structs, one for each extension type;
  • new Msgpax.Unpacker protocol that can be dispatched against the specific Msgpax.Ext# structs;
  • new Msgpax.Ext.defimpl macro to allow users to overwrite protocol implementations without triggering warnings about module redefinition;

@@ -0,0 +1,49 @@
defmodule Msgpax.Ext.OverwriteTest do
use Msgpax.Case, async: false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests need to be the last one to be run so that the overwrites don't affect the other tests. Hence the async: false, as ExUnit first loads async: true tests.

@y86 y86 marked this pull request as ready for review August 25, 2023 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make default packing configurable

1 participant