From db80a002d6488aae06ef296e8f72cc3acb79d121 Mon Sep 17 00:00:00 2001 From: Carlos Esquerdo Bernat Date: Fri, 29 Dec 2023 09:45:45 +0100 Subject: [PATCH] x.json2: make public the generic function `map_from/1` (#20294) --- vlib/x/json2/json2.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vlib/x/json2/json2.v b/vlib/x/json2/json2.v index 54dbbfadca32db..8d03994568e700 100644 --- a/vlib/x/json2/json2.v +++ b/vlib/x/json2/json2.v @@ -429,7 +429,8 @@ pub fn (f Any) to_time() !time.Time { } } -fn map_from[T](t T) map[string]Any { +// map_from convert a struct to map of Any +pub fn map_from[T](t T) map[string]Any { mut m := map[string]Any{} $if T is $struct { $for field in T.fields {