Documentation
¶
Overview ¶
Package maybe provides optional values as an alternative to using pointers which can lead to many small chunks on the heap. Programs using maybe instances should typically store and pass them as values, not pointers. Maybe instances fully support assignment (=) and equality (==) operators.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct {
// The bool value
Value bool
// True if this instance represents a bool,
// false if it represents nothing.
Valid bool
}
Bool represents a bool value or nothing. The zero value is nothing.
type Float32 ¶
type Float32 struct {
// The float32 value
Value float32
// True if this instance represents a float32,
// false if it represents nothing.
Valid bool
}
Float32 represents a float32 value or nothing. The zero value is nothing.
func NewFloat32 ¶
NewFloat32 returns an instance representing the value x.
type Float64 ¶
type Float64 struct {
// The float64 value
Value float64
// True if this instance represents a float64,
// false if it represents nothing.
Valid bool
}
Float64 represents a float64 value or nothing. The zero value is nothing.
func NewFloat64 ¶
NewFloat64 returns an instance representing the value x.
type Int ¶
type Int struct {
// The int value
Value int
// True if this instance represents an int, false if it represents nothing.
Valid bool
}
Int represents an int value or nothing. The zero value is nothing.
type Int16 ¶
type Int16 struct {
// The int16 value
Value int16
// True if this instance represents an int16, false if it represents nothing.
Valid bool
}
Int16 represents an int16 value or nothing. The zero value is nothing.
type Int32 ¶
type Int32 struct {
// The int32 value
Value int32
// True if this instance represents an int32, false if it represents nothing.
Valid bool
}
Int32 represents an int32 value or nothing. The zero value is nothing.
type Int64 ¶
type Int64 struct {
// The int64 value
Value int64
// True if this instance represents an int64, false if it represents nothing.
Valid bool
}
Int64 represents an int64 value or nothing. The zero value is nothing.
type Int8 ¶
type Int8 struct {
// The int8 value
Value int8
// True if this instance represents an int8, false if it represents nothing.
Valid bool
}
Int8 represents an int8 value or nothing. The zero value is nothing.
type String ¶
type String struct {
// The string value
Value string
// True if this instance represents a string,
// false if it represents nothing.
Valid bool
}
String represents a string value or nothing. The zero value is nothing.
type Uint ¶
type Uint struct {
// The uint value
Value uint
// True if this instance represents an uint, false if it represents nothing.
Valid bool
}
Uint represents an uint value or nothing. The zero value is nothing.
type Uint16 ¶
type Uint16 struct {
// The uint16 value
Value uint16
// True if this instance represents an uint16, false if it represents nothing.
Valid bool
}
Uint16 represents an uint16 value or nothing. The zero value is nothing.
type Uint32 ¶
type Uint32 struct {
// The uint32 value
Value uint32
// True if this instance represents an uint32, false if it represents nothing.
Valid bool
}
Uint32 represents an uint32 value or nothing. The zero value is nothing.
type Uint64 ¶
type Uint64 struct {
// The uint64 value
Value uint64
// True if this instance represents an uint64, false if it represents nothing.
Valid bool
}
Uint64 represents an uint64 value or nothing. The zero value is nothing.