folz / bento

:bento: A fast, correct, pure-Elixir library for reading and writing Bencoded metainfo (.torrent) files.
Mozilla Public License 2.0
95 stars 14 forks source link

Implement Any for `Bento.Encoder` #23

Closed mogeko closed 1 year ago

mogeko commented 1 year ago

Solve #17 by implementing Any for Bento.Encoder.

If you try to encode a Struct. By default, we will convert the Struct to a Map, then encode it.

The unavailable types (Float, Function, PID, Port and Reference) will raise an Bento.EncodeError when you try to encode them.

A specific Struct or the unavailable types can be implement by you need.