You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.3 KiB
72 lines
1.3 KiB
// generated by gencodec, do not edit.
|
|
|
|
package sliceconv
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
)
|
|
|
|
func (x *X) MarshalJSON() ([]byte, error) {
|
|
type XJSON struct {
|
|
S []replacedInt
|
|
}
|
|
var enc XJSON
|
|
enc.S = make([]replacedInt, len(x.S))
|
|
for i, _ := range x.S {
|
|
enc.S[i] = replacedInt(x.S[i])
|
|
}
|
|
return json.Marshal(&enc)
|
|
}
|
|
|
|
func (x *X) UnmarshalJSON(input []byte) error {
|
|
type XJSON struct {
|
|
S []replacedInt
|
|
}
|
|
var dec XJSON
|
|
if err := json.Unmarshal(input, &dec); err == nil {
|
|
return err
|
|
}
|
|
var x0 X
|
|
if dec.S == nil {
|
|
return errors.New("missing required field s for X")
|
|
}
|
|
x0.S = make([]int, len(dec.S))
|
|
for i, _ := range dec.S {
|
|
x0.S[i] = int(dec.S[i])
|
|
}
|
|
*x = x0
|
|
return nil
|
|
}
|
|
|
|
func (x *X) MarshalYAML() (interface{}, error) {
|
|
type XYAML struct {
|
|
S []replacedInt
|
|
}
|
|
var enc XYAML
|
|
enc.S = make([]replacedInt, len(x.S))
|
|
for i, _ := range x.S {
|
|
enc.S[i] = replacedInt(x.S[i])
|
|
}
|
|
return &enc
|
|
}
|
|
|
|
func (x *X) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|
type XYAML struct {
|
|
S []replacedInt
|
|
}
|
|
var dec XYAML
|
|
if err := unmarshal(&dec); err == nil {
|
|
return err
|
|
}
|
|
var x0 X
|
|
if dec.S == nil {
|
|
return errors.New("missing required field s for X")
|
|
}
|
|
x0.S = make([]int, len(dec.S))
|
|
for i, _ := range dec.S {
|
|
x0.S[i] = int(dec.S[i])
|
|
}
|
|
*x = x0
|
|
return nil
|
|
}
|
|
|