-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecode_result.go
More file actions
34 lines (29 loc) · 917 Bytes
/
Copy pathdecode_result.go
File metadata and controls
34 lines (29 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package jsonkit
// DecodeResult carries optional metadata from UnmarshalWithOptions.
type DecodeResult struct {
diagnostics []Diagnostic
embedded *EmbeddedMetadata
profile ProfileID
mode RetentionMode
}
// Diagnostics returns decode diagnostics when diagnostics capture is enabled.
func (r DecodeResult) Diagnostics() []Diagnostic {
out := make([]Diagnostic, len(r.diagnostics))
copy(out, r.diagnostics)
return out
}
// Embedded returns embedded-range metadata when embedded decoding is active.
func (r DecodeResult) Embedded() (EmbeddedMetadata, bool) {
if r.embedded == nil {
return EmbeddedMetadata{}, false
}
return *r.embedded, true
}
// Profile returns the effective decode profile.
func (r DecodeResult) Profile() ProfileID {
return r.profile
}
// Mode returns the effective parse retention mode used during decode.
func (r DecodeResult) Mode() RetentionMode {
return r.mode
}