float

package
Version: v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2021 License: Unlicense, Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var F, E, W, I, D, T log.LevelPrinter = log.GetLogPrinterSet(subsystem)

Functions

This section is empty.

Types

type Hook

type Hook func(f float64) error

type Opt

type Opt struct {
	meta.Data

	Min, Max float64

	Value *uberatomic.Float64
	Def   float64
	// contains filtered or unexported fields
}

Opt stores an float64 configuration value

func New

func New(m meta.Data, def float64, min, max float64, hook ...Hook) *Opt

New returns a new Opt value set to a default value

func (*Opt) AddHooks

func (x *Opt) AddHooks(hook ...Hook)

AddHooks appends callback hooks to be run when the value is changed

func (*Opt) GetMetadata

func (x *Opt) GetMetadata() *meta.Data

GetMetadata returns the metadata of the opt type

func (*Opt) LoadInput

func (x *Opt) LoadInput(input string) (o opt.Option, e error)

LoadInput sets the value from a string (this is the same as the above but differs for Strings)

func (*Opt) MarshalJSON

func (x *Opt) MarshalJSON() (b []byte, e error)

MarshalJSON returns the json representation of

func (*Opt) Name

func (x *Opt) Name() string

Name returns the name of the opt

func (*Opt) ReadInput

func (x *Opt) ReadInput(input string) (o opt.Option, e error)

ReadInput sets the value from a string

func (*Opt) Set

func (x *Opt) Set(f float64) (e error)

Set the value stored

func (*Opt) SetHooks

func (x *Opt) SetHooks(hook ...Hook)

SetHooks sets a new slice of hooks

func (*Opt) SetName

func (x *Opt) SetName(name string)

SetName sets the name for the generator

func (*Opt) String

func (x *Opt) String() string

String returns a string representation of the value

func (*Opt) Type

func (x *Opt) Type() interface{}

Type returns the receiver wrapped in an interface for identifying its type

func (*Opt) UnmarshalJSON

func (x *Opt) UnmarshalJSON(data []byte) (e error)

UnmarshalJSON decodes a JSON representation of

func (*Opt) V

func (x *Opt) V() float64

V returns the value stored

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL