aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/gen_config.go
blob: 2f10dcdb844df3346251a4c20488d728e977ff17 (plain) (blame)
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
// Code generated by github.com/fjl/gencodec. DO NOT EDIT.

package whisperv5

func (c Config) MarshalTOML() (interface{}, error) {
    type Config struct {
        MaxMessageSize     uint32  `toml:",omitempty"`
        MinimumAcceptedPOW float64 `toml:",omitempty"`
    }
    var enc Config
    enc.MaxMessageSize = c.MaxMessageSize
    enc.MinimumAcceptedPOW = c.MinimumAcceptedPOW
    return &enc, nil
}

func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
    type Config struct {
        MaxMessageSize     *uint32  `toml:",omitempty"`
        MinimumAcceptedPOW *float64 `toml:",omitempty"`
    }
    var dec Config
    if err := unmarshal(&dec); err != nil {
        return err
    }
    if dec.MaxMessageSize != nil {
        c.MaxMessageSize = *dec.MaxMessageSize
    }
    if dec.MinimumAcceptedPOW != nil {
        c.MinimumAcceptedPOW = *dec.MinimumAcceptedPOW
    }
    return nil
}