Revision faf83b3a79b050cb8eecf865a9377c34ebd1cf47 authored by Marge Bot on 02 February 2024, 16:08:48 UTC, committed by Marge Bot on 02 February 2024, 16:08:48 UTC
Co-authored-by: Killian Delarue <killian.delarue@nomadic-labs.com> Approved-by: Arvid Jakobsson <arvid.jakobsson@nomadic-labs.com> Approved-by: Nic Volanschi <nic.volanschi@nomadic-labs.com> See merge request https://gitlab.com/tezos/tezos/-/merge_requests/11768
reference.mli
(*****************************************************************************)
(* *)
(* Open Source License *)
(* Copyright (c) 2023 Nomadic Labs, <contact@nomadic-labs.com> *)
(* *)
(* Permission is hereby granted, free of charge, to any person obtaining a *)
(* copy of this software and associated documentation files (the "Software"),*)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)
(* and/or sell copies of the Software, and to permit persons to whom the *)
(* Software is furnished to do so, subject to the following conditions: *)
(* *)
(* The above copyright notice and this permission notice shall be included *)
(* in all copies or substantial portions of the Software. *)
(* *)
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)
(* DEALINGS IN THE SOFTWARE. *)
(* *)
(*****************************************************************************)
(** Abstraction module for OCaml references *)
(** Type [('perm, 'value) t] represents references containing a value
of type ['value] and permissions specified by ['perm]. *)
type ('perm, 'value) t
(** Read/write reference {!t}. *)
type 'a rw = ([`Read | `Write], 'a) t
(** Read only reference {!t}. *)
type 'a ro = ([`Read], 'a) t
(** [get r] returns the value held by reference [r]. *)
val get : (_, 'a) t -> 'a
(** [set r v] sets reference [r] to the value [v]. *)
val set : 'a rw -> 'a -> unit
(** [map r f] apply [f] to the current value [v] held in the reference
[r]. *)
val map : ('a -> 'a) -> 'a rw -> unit
(** [new_ v] creates a fresh reference holding value [v]. *)
val new_ : 'a -> (_, 'a) t
(** [readonly r] casts reference [r] to be read only. *)
val readonly : (_, 'a) t -> 'a ro
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...