module Utils: sig
.. end
This module regroups miscellaneous utility functions.
val verbose : string -> unit
Prints the passed string if Bolt verbose mode is enabled,
does nothing otherwise.
type 'a
container
The type of container mapping a string to an element,
whatever their implementation is.
val make_container_functions : unit ->
'a container * (string -> 'a -> unit) * ('a -> string) * (string -> 'a)
make_container_functions ()
returns a quadruple with the following
elements:
- a container;
- a function that adds a named element to the container;
- a function that adds an unnamed element to the container,
and returns its name;
- a function that returns the element whose name is passed,
raising
Not_found
if such an element does not exist.
val get_thread_id : unit -> int
Returns the identifier of the current thread.
val enter_critical_section : unit -> unit
To be called when entering a critical section.
val leave_critical_section : unit -> unit
To be called when leaving a critical section.
val split : string -> string -> string list
split seps s
returns a list of substrings of s
separeted by
contiguous substrings of elements from seps
.
val trim_left : string -> string
Returns a copy of the string without leading whitespace.
val trim_right : string -> string
Returns a copy of the string without trailing whitespace.
val trim : string -> string
Returns a copy of the string without leading and trailing whitespace.