toml: add doc string to reflect methods (#12666)
parent
33163238e7
commit
7e6d4ebfe1
|
@ -227,6 +227,8 @@ fn (a Any) value_(value Any, key []string) Any {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reflect returns `T` with `T.<field>`'s value set to the
|
||||||
|
// value of any 1st level TOML key by the same name.
|
||||||
pub fn (a Any) reflect<T>() T {
|
pub fn (a Any) reflect<T>() T {
|
||||||
mut reflected := T{}
|
mut reflected := T{}
|
||||||
$for field in T.fields {
|
$for field in T.fields {
|
||||||
|
|
|
@ -173,6 +173,8 @@ pub fn (d Doc) to_any() Any {
|
||||||
return ast_to_any(d.ast.table)
|
return ast_to_any(d.ast.table)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reflect returns `T` with `T.<field>`'s value set to the
|
||||||
|
// value of any 1st level TOML key by the same name.
|
||||||
pub fn (d Doc) reflect<T>() T {
|
pub fn (d Doc) reflect<T>() T {
|
||||||
return d.to_any().reflect<T>()
|
return d.to_any().reflect<T>()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue