oncecell

package module
v0.0.0-...-e55c66a Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestGetMyTypeValue

func TestGetMyTypeValue(t *testing.T)

func TestMultiMustSetMyTypeValue

func TestMultiMustSetMyTypeValue(t *testing.T)

func TestMultiSetMyTypeValue

func TestMultiSetMyTypeValue(t *testing.T)

func TestMustGetMyTypeValue

func TestMustGetMyTypeValue(t *testing.T)

func TestMustSetMyTypeValue

func TestMustSetMyTypeValue(t *testing.T)

func TestSetMyTypeValue

func TestSetMyTypeValue(t *testing.T)

func TestSyncMultiSetMyTypeValue

func TestSyncMultiSetMyTypeValue(t *testing.T)

Types

type OnceBool

type OnceBool struct {
	// contains filtered or unexported fields
}

OnceBool wraps a bool and enforces at runtime that the value is set at most once.

func (*OnceBool) MustSetValue

func (o *OnceBool) MustSetValue(value bool)

MustSetValue sets the value of the bool to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceBool) MustValue

func (o *OnceBool) MustValue() bool

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceBool) SetValue

func (o *OnceBool) SetValue(value bool) error

SetValue sets the value of the bool to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceBool) Value

func (o *OnceBool) Value() (retval bool, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceComplex128

type OnceComplex128 struct {
	// contains filtered or unexported fields
}

OnceComplex128 wraps a complex128 and enforces at runtime that the value is set at most once.

func (*OnceComplex128) MustSetValue

func (o *OnceComplex128) MustSetValue(value complex128)

MustSetValue sets the value of the complex128 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceComplex128) MustValue

func (o *OnceComplex128) MustValue() complex128

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceComplex128) SetValue

func (o *OnceComplex128) SetValue(value complex128) error

SetValue sets the value of the complex128 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceComplex128) Value

func (o *OnceComplex128) Value() (retval complex128, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceComplex64

type OnceComplex64 struct {
	// contains filtered or unexported fields
}

OnceComplex64 wraps a complex64 and enforces at runtime that the value is set at most once.

func (*OnceComplex64) MustSetValue

func (o *OnceComplex64) MustSetValue(value complex64)

MustSetValue sets the value of the complex64 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceComplex64) MustValue

func (o *OnceComplex64) MustValue() complex64

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceComplex64) SetValue

func (o *OnceComplex64) SetValue(value complex64) error

SetValue sets the value of the complex64 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceComplex64) Value

func (o *OnceComplex64) Value() (retval complex64, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceFloat32

type OnceFloat32 struct {
	// contains filtered or unexported fields
}

OnceFloat32 wraps a float32 and enforces at runtime that the value is set at most once.

func (*OnceFloat32) MustSetValue

func (o *OnceFloat32) MustSetValue(value float32)

MustSetValue sets the value of the float32 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceFloat32) MustValue

func (o *OnceFloat32) MustValue() float32

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceFloat32) SetValue

func (o *OnceFloat32) SetValue(value float32) error

SetValue sets the value of the float32 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceFloat32) Value

func (o *OnceFloat32) Value() (retval float32, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceFloat64

type OnceFloat64 struct {
	// contains filtered or unexported fields
}

OnceFloat64 wraps a float64 and enforces at runtime that the value is set at most once.

func (*OnceFloat64) MustSetValue

func (o *OnceFloat64) MustSetValue(value float64)

MustSetValue sets the value of the float64 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceFloat64) MustValue

func (o *OnceFloat64) MustValue() float64

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceFloat64) SetValue

func (o *OnceFloat64) SetValue(value float64) error

SetValue sets the value of the float64 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceFloat64) Value

func (o *OnceFloat64) Value() (retval float64, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceInt

type OnceInt struct {
	// contains filtered or unexported fields
}

OnceInt wraps a int and enforces at runtime that the value is set at most once.

func (*OnceInt) MustSetValue

func (o *OnceInt) MustSetValue(value int)

MustSetValue sets the value of the int to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt) MustValue

func (o *OnceInt) MustValue() int

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceInt) SetValue

func (o *OnceInt) SetValue(value int) error

SetValue sets the value of the int to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt) Value

func (o *OnceInt) Value() (retval int, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceInt16

type OnceInt16 struct {
	// contains filtered or unexported fields
}

OnceInt16 wraps a int16 and enforces at runtime that the value is set at most once.

func (*OnceInt16) MustSetValue

func (o *OnceInt16) MustSetValue(value int16)

MustSetValue sets the value of the int16 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt16) MustValue

func (o *OnceInt16) MustValue() int16

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceInt16) SetValue

func (o *OnceInt16) SetValue(value int16) error

SetValue sets the value of the int16 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt16) Value

func (o *OnceInt16) Value() (retval int16, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceInt32

type OnceInt32 struct {
	// contains filtered or unexported fields
}

OnceInt32 wraps a int32 and enforces at runtime that the value is set at most once.

func (*OnceInt32) MustSetValue

func (o *OnceInt32) MustSetValue(value int32)

MustSetValue sets the value of the int32 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt32) MustValue

func (o *OnceInt32) MustValue() int32

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceInt32) SetValue

func (o *OnceInt32) SetValue(value int32) error

SetValue sets the value of the int32 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt32) Value

func (o *OnceInt32) Value() (retval int32, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceInt64

type OnceInt64 struct {
	// contains filtered or unexported fields
}

OnceInt64 wraps a int64 and enforces at runtime that the value is set at most once.

func (*OnceInt64) MustSetValue

func (o *OnceInt64) MustSetValue(value int64)

MustSetValue sets the value of the int64 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt64) MustValue

func (o *OnceInt64) MustValue() int64

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceInt64) SetValue

func (o *OnceInt64) SetValue(value int64) error

SetValue sets the value of the int64 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt64) Value

func (o *OnceInt64) Value() (retval int64, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceInt8

type OnceInt8 struct {
	// contains filtered or unexported fields
}

OnceInt8 wraps a int8 and enforces at runtime that the value is set at most once.

func (*OnceInt8) MustSetValue

func (o *OnceInt8) MustSetValue(value int8)

MustSetValue sets the value of the int8 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt8) MustValue

func (o *OnceInt8) MustValue() int8

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceInt8) SetValue

func (o *OnceInt8) SetValue(value int8) error

SetValue sets the value of the int8 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceInt8) Value

func (o *OnceInt8) Value() (retval int8, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceMyType

type OnceMyType struct {
	// contains filtered or unexported fields
}

OnceMyType wraps a myType and enforces at runtime that the value is set at most once.

func (*OnceMyType) MustSetValue

func (o *OnceMyType) MustSetValue(value myType)

MustSetValue sets the value of the myType to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceMyType) MustValue

func (o *OnceMyType) MustValue() myType

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceMyType) SetValue

func (o *OnceMyType) SetValue(value myType) error

SetValue sets the value of the myType to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceMyType) Value

func (o *OnceMyType) Value() (retval myType, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceString

type OnceString struct {
	// contains filtered or unexported fields
}

OnceString wraps a string and enforces at runtime that the value is set at most once.

func (*OnceString) MustSetValue

func (o *OnceString) MustSetValue(value string)

MustSetValue sets the value of the string to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceString) MustValue

func (o *OnceString) MustValue() string

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceString) SetValue

func (o *OnceString) SetValue(value string) error

SetValue sets the value of the string to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceString) Value

func (o *OnceString) Value() (retval string, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceUint

type OnceUint struct {
	// contains filtered or unexported fields
}

OnceUint wraps a uint and enforces at runtime that the value is set at most once.

func (*OnceUint) MustSetValue

func (o *OnceUint) MustSetValue(value uint)

MustSetValue sets the value of the uint to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint) MustValue

func (o *OnceUint) MustValue() uint

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceUint) SetValue

func (o *OnceUint) SetValue(value uint) error

SetValue sets the value of the uint to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint) Value

func (o *OnceUint) Value() (retval uint, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceUint16

type OnceUint16 struct {
	// contains filtered or unexported fields
}

OnceUint16 wraps a uint16 and enforces at runtime that the value is set at most once.

func (*OnceUint16) MustSetValue

func (o *OnceUint16) MustSetValue(value uint16)

MustSetValue sets the value of the uint16 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint16) MustValue

func (o *OnceUint16) MustValue() uint16

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceUint16) SetValue

func (o *OnceUint16) SetValue(value uint16) error

SetValue sets the value of the uint16 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint16) Value

func (o *OnceUint16) Value() (retval uint16, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceUint32

type OnceUint32 struct {
	// contains filtered or unexported fields
}

OnceUint32 wraps a uint32 and enforces at runtime that the value is set at most once.

func (*OnceUint32) MustSetValue

func (o *OnceUint32) MustSetValue(value uint32)

MustSetValue sets the value of the uint32 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint32) MustValue

func (o *OnceUint32) MustValue() uint32

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceUint32) SetValue

func (o *OnceUint32) SetValue(value uint32) error

SetValue sets the value of the uint32 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint32) Value

func (o *OnceUint32) Value() (retval uint32, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceUint64

type OnceUint64 struct {
	// contains filtered or unexported fields
}

OnceUint64 wraps a uint64 and enforces at runtime that the value is set at most once.

func (*OnceUint64) MustSetValue

func (o *OnceUint64) MustSetValue(value uint64)

MustSetValue sets the value of the uint64 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint64) MustValue

func (o *OnceUint64) MustValue() uint64

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceUint64) SetValue

func (o *OnceUint64) SetValue(value uint64) error

SetValue sets the value of the uint64 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint64) Value

func (o *OnceUint64) Value() (retval uint64, err error)

Value returns the value stored in the cell or an error if it has not yet been set

type OnceUint8

type OnceUint8 struct {
	// contains filtered or unexported fields
}

OnceUint8 wraps a uint8 and enforces at runtime that the value is set at most once.

func (*OnceUint8) MustSetValue

func (o *OnceUint8) MustSetValue(value uint8)

MustSetValue sets the value of the uint8 to the provided value. This function will panic if the value has already been set This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint8) MustValue

func (o *OnceUint8) MustValue() uint8

MustValue returns the value stored in the cell or panics if it has not yet been set

func (*OnceUint8) SetValue

func (o *OnceUint8) SetValue(value uint8) error

SetValue sets the value of the uint8 to the provided value. This function will return an error if called more than once. This is thread-safe as the isSet flag is atomically set, thus ensuring that no two callers can check the flag at the same time.

func (*OnceUint8) Value

func (o *OnceUint8) Value() (retval uint8, err error)

Value returns the value stored in the cell or an error if it has not yet been set

Jump to

Keyboard shortcuts

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