From 9250e3891da4e9c072adaef8517b5ce5f3732dd1 Mon Sep 17 00:00:00 2001 From: Julien Tesson Date: Mon, 12 Nov 2018 13:25:05 +0100 Subject: [PATCH] P2p: add `P2p_point.Id.pp_list` --- src/lib_base/p2p_point.ml | 3 +++ src/lib_base/p2p_point.mli | 1 + 2 files changed, 4 insertions(+) diff --git a/src/lib_base/p2p_point.ml b/src/lib_base/p2p_point.ml index 6bd562a7c..b7445ad5a 100644 --- a/src/lib_base/p2p_point.ml +++ b/src/lib_base/p2p_point.ml @@ -2,6 +2,7 @@ (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. *) +(* Copyright (c) 2019 Nomadic Labs, *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) @@ -42,6 +43,8 @@ module Id = struct let pp_opt ppf = function | None -> Format.pp_print_string ppf "none" | Some point -> pp ppf point + let pp_list ppf point_list = + Format.pp_print_list ~pp_sep:Format.pp_print_space pp ppf point_list let is_local (addr, _) = Ipaddr.V6.is_private addr let is_global (addr, _) = not @@ Ipaddr.V6.is_private addr diff --git a/src/lib_base/p2p_point.mli b/src/lib_base/p2p_point.mli index 2b186f717..63f475f28 100644 --- a/src/lib_base/p2p_point.mli +++ b/src/lib_base/p2p_point.mli @@ -32,6 +32,7 @@ module Id : sig val pp : Format.formatter -> t -> unit val pp_opt : Format.formatter -> t option -> unit + val pp_list : Format.formatter -> t list -> unit val of_string_exn : string -> t val of_string : string -> (t, string) result