Module Iobuf.Snapshot

module Snapshot: sig .. end  with type ('d, 'w) iobuf := ('d, 'w) t
One can call snapshot t to get a snapshot of the front of the window, and then later restore that snapshot. This is useful for speculatively parsing, and then rewinding when there isn't enough data to finish.

Using a snapshot with a different iobuf, even a sub iobuf of the snapshotted one, has unspecified results. An exception may be raised, or a silent error may occur. However, the safety guarantees of the iobuf will not be violated, i.e., the attempt will not enlarge the limits of the subject iobuf.


type t 
val restore : t -> ('a, Iobuf.seek) t -> unit
val sexp_of_t : t -> Sexplib.Sexp.t