1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

comment why values are changed in decoding method

This commit is contained in:
Turiiya 2023-08-10 16:47:49 +02:00
parent b47ddc6c5b
commit 21d98ff904

View File

@ -77,8 +77,9 @@ pub fn (mut e Employee) from_toml(any toml.Any) {
mp := any.as_map()
e.name = mp['name'] or { toml.Any('') }.string()
e.age = mp['age'] or { toml.Any(0) }.int()
e.salary = mp['salary'] or { toml.Any(0) }.f32() - 15000.0
e.is_human = mp['is_human'] or { toml.Any(false) }.bool()
// Change some values to assert that the structs method is used instead of generic decoding.
e.salary = mp['salary'] or { toml.Any(0) }.f32() - 15000.0
e.title = unsafe { JobTitle(mp['title'] or { toml.Any(0) }.int() - 2) }
}