Module Mac_addressSource

Functions for working with and formatting 48-bit MAC addresses.

Sourcetype t = private Core.Int63.t

private Int63.t to enable immediate-type optimizations on 64-bit platforms.

include Ppx_compare_lib.Comparable.S with type t := t
include Ppx_compare_lib.Comparable.S__local with type t := t
Sourceval t_sexp_grammar : t Sexplib0.Sexp_grammar.t @@ portable
include Typerep_lib.Typerepable.S with type t := t
Sourceval typerep_of_t : t Typerep_lib.Std_internal.Typerep.t @@ portable
Sourceval typename_of_t : t Typerep_lib.Typename.t @@ portable
include Core.Comparator.S__portable with type t := t
Sourcetype comparator_witness : value mod portable

of_string and t_of_sexp accept any string-style notation (see String_style below). They accept both lowercase and uppercase hex digits. to_string and sexp_of_t use Dash style and lowercase hex digits.

include Core.Identifiable.S_plain with type t := t and type comparator_witness := comparator_witness
include Ppx_compare_lib.Comparable.S with type t := t
include Ppx_hash_lib.Hashable.S with type t := t
include Base.Stringable.S with type t := t
include Base.Stringable.Of_stringable with type t := t
Sourceval of_string : string -> t
include Base.Stringable.To_stringable with type t := t
Sourceval to_string : t -> string
include Base.Pretty_printer.S with type t := t
Sourceval pp : Base.Formatter.t -> t -> unit
include Core.Comparable.S_plain with type t := t with type comparator_witness := comparator_witness
include Base.Comparable.S with type t := t with type comparator_witness := comparator_witness
include Base.Comparisons.S with type t := t
include Base.Comparisons.Infix with type t := t
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
val equal : t -> t -> bool
val min : t -> t -> t
val max : t -> t -> t
Sourceval ascending : t -> t -> int

ascending is identical to compare. descending x y = ascending y x. These are intended to be mnemonic when used like List.sort ~compare:ascending and List.sort ~cmp:descending, since they cause the list to be sorted in ascending or descending order, respectively.

Sourceval descending : t -> t -> int
Sourceval between : t -> low:t -> high:t -> bool

between t ~low ~high means low <= t <= high

Sourceval clamp_exn : t -> min:t -> max:t -> t

clamp_exn t ~min ~max returns t', the closest value to t such that between t' ~low:min ~high:max is true.

Raises if not (min <= max).

Sourceval clamp : t -> min:t -> max:t -> t Base.Or_error.t
Sourceval validate_lbound : min:t Core.Maybe_bound.t -> t Validate.check
Sourceval validate_ubound : max:t Core.Maybe_bound.t -> t Validate.check
Sourceval validate_bound : min:t Core.Maybe_bound.t -> max:t Core.Maybe_bound.t -> t Validate.check
include Core.Hashable.S_plain with type t := t
include Ppx_compare_lib.Comparable.S with type t := t
val compare : t -> t -> int
Sourceval hashable : t Base.Hashable.t
Sourcemodule Table : Core.Hashtbl.S_plain with type key = t
include Sexplib0.Sexpable.Sexp_of__stack with type t := t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
include Core.Quickcheckable with type t := t
Sourceval quickcheck_generator : t Base_quickcheck.Generator.t
Sourceval quickcheck_observer : t Base_quickcheck.Observer.t
Sourceval quickcheck_shrinker : t Base_quickcheck.Shrinker.t
Sourceval of_int_exn : int -> t @@ portable [@@zero_alloc]

More significant bytes in the integer go first in the address:

  0x112233445566 <-> 11-22-33-44-55-66
Sourceval to_int_exn : t -> int @@ portable [@@zero_alloc]
Sourceval of_int63_exn : Core.Int63.t -> t @@ portable
Sourceval to_int63 : t -> Core.Int63.t @@ portable
Sourcemodule String_style : sig ... end
Sourceval to_string_with_style : t -> style:String_style.t -> string @@ portable

to_string_with_style produces the dash-, colon-, or dot-separated string representation of the given MAC. It produces only lowercase hex digits.

Sourceval to_string_colon : t -> string @@ portable

to_string_colon is an alias for: to_string_with_style ~style:Colon

Sourceval to_string_compact : t -> string @@ portable

to_string_compact is an alias for: to_string_with_style ~style:Compact

Sourceval to_string_dash : t -> string @@ portable

to_string_dash is an alias for: to_string_with_style ~style:Dash

Sourceval to_string_dot : t -> string @@ portable

to_string_dot is an alias for: to_string_with_style ~style:Dot

Sourceval broadcast : t @@ portable

broadcast is ff-ff-ff-ff-ff-ff

Sourceval any : t @@ portable

any is 00-00-00-00-00-00

Sourceval random_incl : ?state:Core.Random.State.t -> t -> t -> t @@ portable

random_incl ~state lo hi returns a random t between lo (inclusive) and hi (inclusive). Raises if lo > hi. The comparison is such that the first byte in the address is the most significant, i.e. 00-00-00-00-00-01 < 01-00-00-00-00-00.

The default ~state is Random.State.default.

Sourcemodule Option : sig ... end
Sourcemodule Unstable : sig ... end

Unstable provides (de)serializations that may change over time. In general, we suggest using Stable, below, for (de)serializations.

Sourcemodule Stable : sig ... end