+let is_mapped_range ({ mappings = mappings } as t) addr size =
+ match mappings with
+ (* NB: No [`HasMapping] in the type so we have to check mappings <> []. *)
+ | [] -> false
+ | _ ->
+ (* Quick and dirty. It's possible to make a much faster
+ * implementation of this which doesn't call the closure for every
+ * byte.
+ *)
+ let size = ref size in
+ try dowhile t addr (fun _ _ -> decr size; !size > 0); true
+ with Invalid_argument "dowhile" -> false
+