add Cursor::peekBytes()
Summary:
The existing Cursor::peek() method pre-dates the existence of folly::ByteRange,
and so it returns a std::pair containing a pointer and length. This is usually
more awkward to use than ByteRange.
This adds a peekBytes() method that returns a ByteRange object, and updates all
users of peek() in folly to use peekBytes() instead. Eventually I think we
should add a FOLLY_DEPRECATED attribute to peek(). I will wait to add this tag
until after converting a few other projects to use peekBytes(), though.
Reviewed By: alandau
Differential Revision:
D3337302
fbshipit-source-id:
14220a059d915bf5adc66b8b283f7228b796a4dc