module Byte_units: sig
.. end
create measure value
creates a t
from value
units of the given measure.
module Measure: sig
.. end
type
t
val create : Measure.t -> float -> t
create measure value
creates a t
from value
units of the given measure.
include Comparable.S
include Hashable.S
include Stringable.S
val to_string_hum : ?measure:Measure.t -> t -> string
to_string_hum ?measure t
returns a string representation of t
. If measure
is
not given then the largest measure (excluding `Words
) is used that causes the
translated value to exceed 1.
val bytes : t -> float
val kilobytes : t -> float
val megabytes : t -> float
val gigabytes : t -> float
val words : t -> float
val scale : t -> float -> t
scale t mul
scale the measure t
by mul
module Infix: sig
.. end
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
create measure value
creates a t
from value
units of the given measure.
to_string_hum ?measure t
returns a string representation of t
. If measure
is
not given then the largest measure (excluding `Words
) is used that causes the
translated value to exceed 1.
scale t mul
scale the measure t
by mul
( / ) t mul
scales t
by 1/mul
( // ) t1 t2
returns the ratio of t1 to t2