| ... | @@ -214,10 +214,7 @@ pub const Options = struct { | ... | @@ -214,10 +214,7 @@ pub const Options = struct { |
| 214 | ignore_unknown_fields: bool = false, | 214 | ignore_unknown_fields: bool = false, |
| 215 | }; | 215 | }; |
| 216 | | 216 | |
| 217 | /// Parses the given slice as ZON. | 217 | /// Parses the given slice as ZON, writing any errors to `options.errors`. |
| 218 | /// | | |
| 219 | /// Human readable errors are written to `options.errors`. `options.arena` owns the errors, and any | | |
| 220 | /// pointers that are part of `T`. | | |
| 221 | pub fn fromSlice(T: type, options: Options) error{ OutOfMemory, ParseZon }!T { | 218 | pub fn fromSlice(T: type, options: Options) error{ OutOfMemory, ParseZon }!T { |
| 222 | var value: T = undefined; | 219 | var value: T = undefined; |
| 223 | try fromSliceInner(T, &value, false, options); | 220 | try fromSliceInner(T, &value, false, options); |
| ... | @@ -269,11 +266,12 @@ pub fn fromSliceNoAlloc(T: type, options: Options) error{ OutOfMemory, ParseZon | ... | @@ -269,11 +266,12 @@ pub fn fromSliceNoAlloc(T: type, options: Options) error{ OutOfMemory, ParseZon |
| 269 | return fromSlice(T, options); | 266 | return fromSlice(T, options); |
| 270 | } | 267 | } |
| 271 | | 268 | |
| 272 | /// Similar to `fromSlice`, but updates `value` in place. `value` must be initialized before this | 269 | /// Similar to `fromSlice`, but updates the existing contents of `value` in place. Fields |
| 273 | /// call, fields not specified in ZON are left unchanged. | 270 | /// unspecified by ZON are left unchanged. |
| 274 | /// | 271 | /// |
| 275 | /// Whenever a slice or an untagged union is specified, it completely overwites the previous value. | 272 | /// Assumes that `value` points to a fully initialized value prior to this call. Slices and untagged |
| 276 | /// On error, `value` remains valid, but may be partially updated. | 273 | /// unions are replaced in their entirey when specified. On error, `value` remains valid, but may be |
| | 274 | /// partially updated. |
| 277 | pub fn updateFromSlice( | 275 | pub fn updateFromSlice( |
| 278 | T: type, | 276 | T: type, |
| 279 | value: *T, | 277 | value: *T, |