Bencode
A zero dependency bencode parsing library.
Usage + Examples
check out examples/ubuntu_torrent.rs
cargo run --example ubuntu_torrent
```rust
// get your torrent file as bytes.
let ubuntutorrentfile: Vec = std::fs::read("torrent_files/ubuntu.torrent").unwrap();
// Bencode::frombytes will traverse the byte array and read it into a bencode object.
let ubuntutorrentbencode: Bencode = Bencode::frombytes(ubuntutorrentfile.as_slice())
// it returns a Result<(Bencode, usize), BencodeError>
.unwrap()
// the first item is the Bencode tree,
// the second object is the index of the last parsed byte.
.0;
```
Roadmap
- Publish bencode lib as a standalone library on crates.
- Publish bien as a commandline tool.
- Optimize the bencode parser, (for fun and profit)
- setup some sort of CI build with metrics.
- (Maybe) Try to get bien published into some sort of package manager ... ?
- Investigate if this is a lot of work.
Todo List
- [x] Create File Structure
- [x] Create Parser Functions
- [x] Integer value parser
- [x] ByteString value parser
- [x] List parser
- [x] Nested List support & tests
- [x] Dictionary parser
- [x] Nested Dict support & tests
- [x] Implement proper errors, not just
panic!
AKA: Don't Panic
- [x] Add (un)happy path testing to assert proper error values.
- [ ] Add useful messages and metadata to the error types.
- [ ] Add a whole bunch of edge case tests