x.json2: make public the generic function map_from/1 (#20294)

This commit is contained in:
Carlos Esquerdo Bernat 2023-12-29 09:45:45 +01:00 committed by GitHub
parent fe017afeb0
commit db80a002d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {