Module Base__.Ordered_collection_common
val get_pos_len : ?pos:int -> ?len:int -> unit -> total_length:int -> (int * int) Base.Or_error.tget_pos_len,get_pos_len_exn, andcheck_pos_len_exnare intended to be used by functions that take a sequence (array, string, bigstring, ...) and an optionalposandlenspecifying a subrange of the sequence. Such functions should callget_pos_lenwith the length of the sequence and the optionalposandlen, and it will return theposandlenspecifying the range, where the defaultposis zero and the defaultlenis to go to the end of the sequence.It should be the case that:
pos >= 0 && len >= 0 && pos + len <= total_lengthNote that this allows
pos = total_lengthandlen = 0, i.e., an empty subrange at the end of the sequence.get_pos_lenreturns(pos', len')specifying a subrange where:pos' = match pos with None -> 0 | Some i -> i len' = match len with None -> total_length - pos' | Some i -> i
val get_pos_len_exn : ?pos:int -> ?len:int -> unit -> total_length:int -> int * intval check_pos_len_exn : pos:int -> len:int -> total_length:int -> unitcheck_pos_len_exn ~pos ~len ~total_lengthraises unlesspos >= 0 && len >= 0 && pos + len <= total_length.
module Private : sig ... end