Allow deserialize_seq to deserialize binaries.#708
Allow deserialize_seq to deserialize binaries.#708murisi wants to merge 2 commits intorusterlium:masterfrom
Conversation
evnu
left a comment
There was a problem hiding this comment.
Interesting! Can you add test cases as well (especially cases in rustler_tests?
c64c029 to
98abafc
Compare
I have added a test case which checks that But upon some reflection, this solution is not so nice because it is using So a better/less intrusive solution than this PR might be to just update the documentation at https://docs.rs/rustler/latest/rustler/serde/index.html#conversion-table to either indicate that the |
98abafc to
10b193f
Compare
I came across the bug
** (ErlangError) Erlang error: :nif_panickedwhen trying to do the following NIF call in Elixir:AnomaSDK.Arm.encrypt_cipher(<<96, 109, 146, 170, 18, 27, 248, 118, 203, 31, 65, 72, 51, 153, 179, 35, 168, 62, 88, 150, 244, 119, 198, 51, 20, 106, 74, 8, 143, 32, 45, 168>>). The NIF is defined as follows:Tracking down this error led me to the
Deserializer::deserialize_seqimplementation. It seems that the function does not have the ability to treat Elixir binary terms as sequences. This PR enables Elixir binaries to be treated as sequences (in addition to lists and empty lists) which fixes the NIF panic described above.And thanks for maintaining Rustler, this crate is extremely useful!