basic encoding and decoding (via `to_binary/1` and `from_binary/1`