Documentation ¶
Overview ¶
Package vars contains basic types for manipulating Elvish variables.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBlackhole ¶
IsBlackhole returns whether the variable is a blackhole variable.
Types ¶
type Var ¶
type Var interface { Set(v interface{}) error Get() interface{} }
Var represents an Elvish variable.
func FromGet ¶
func FromGet(get func() interface{}) Var
FromGet makes a variable from a get callback. The variable is read-only.
func FromPtr ¶
func FromPtr(p interface{}) Var
FromPtr creates a variable from a pointer. The variable is kept in sync with the value the pointer points to, using elvToGo and goToElv conversions when Get and Set.
func FromSetGet ¶
FromSetGet makes a variable from a set callback and a get callback.
func NewAnyWithInit ¶
func NewAnyWithInit(v interface{}) Var
NewAnyWithInit creates a variable with an initial value. The variable created can be assigned values of any type.
func NewBlackhole ¶
func NewBlackhole() Var
NewBlackhole returns a blackhole variable. Assignments to a blackhole variable will be discarded, and getting a blackhole variable always returns an empty string.