Owez / torro

A correct and easy-to-use BitTorrent library
MIT License
9 stars 0 forks source link

Remove references to `char` and `str` in bencode parser #8

Closed Owez closed 4 years ago

Owez commented 4 years ago

Issue ported from discord:

I'd suggest you'd just use u8 as your token type, and declare consts for the special meaning characters, instead of this enum with char, because char has no place in bencode handling. You might get char's from doing String::from_utf8 if you have reason to expect it to be utf8, though I'd suggest to use the Result variant there, because you don't wanna panic on user input.