Module benko::util[][src]

A Collection of internal helper functions for the library.

Functions

byte_index

Find the seek byte in the given bytes, or return None.

parse_any

Attempts to parse the given bytes as any of the Bencode types, based on the ascii value of the first byte.

parse_string

Parse a byte slice into a String.

parse_usize

Parse a byte slice into a usize. Assumes bytes are an ascii string of a valid usize value.

wrap_err

Rewrap a result of type Result<R, E> to Result<R, T>.

wrap_res

Rewraps a ParseResult with a Bencode type into a result with a Benc instead so it can be collected more easily.