Skip to content

Add more read_* methods for big/little endian integers #33

@dcsommer

Description

@dcsommer

A straightforward feature that would be quite useful for implementing network protocols would be additional methods on Reader for reading big and little endian integers. The API could be something like:

pub fn read_be<T>(&mut self) -> Result<T, EndOfInput>
pub fn read_le<T>(&mut self) -> Result<T, EndOfInput>

Where T is some integer type. This is similar to the C++ library Cursor, from Folly and fits nicely at the level of pulling bytes safely from the buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions