add clone / insert methods
authorDave Watson <davejwatson@fb.com>
Thu, 15 Nov 2012 18:41:35 +0000 (10:41 -0800)
committerJordan DeLong <jdelong@fb.com>
Sun, 16 Dec 2012 22:45:26 +0000 (14:45 -0800)
commit559830c8a51872c237b01021a71998fcadcec665
tree678bbb47bb8207d322fb4fabc5cb5cb2ac3ed472
parentcb771e84cd1bfd21bfdfb3dd0bae03ecb3ec334f
add clone / insert methods

Summary:
cursor.clone() will clone a length of the chain.  insert(std::move(buf)) will splice in a length of chain
I want this to change thrift2 binary type to IOBuf: we will clone() the network data for zero-copy userspace data, and insert() it if the return value is a IOBuf.

Test Plan: added unittest

Reviewed By: afrind@fb.com

FB internal diff: D632073
folly/experimental/io/Cursor.h
folly/experimental/io/test/IOBufCursorTest.cpp