Documentation
¶
Index ¶
Constants ¶
const ( // CSI Pm m -- Character Attributes (SGR). NORMAL = 0 // Normal (default), VT100. BOLD = 1 // Bold, VT100. FAINT = 2 // Faint, decreased intensity, ECMA-48 2nd. ITALICS = 3 // Italicized, ECMA-48 2nd. UNDERLINE = 4 // Underlined, VT100. BLINK = 5 // Blink, VT100. INVERSE = 7 // Inverse, VT100. STRIKETHROUGH = 9 // Crossed-out characters, ECMA-48 3rd. BLACK = 0 RED = 1 GREEN = 2 YELLOW = 3 BLUE = 4 MAGENTA = 5 CYAN = 6 WHITE = 7 DEFAULT = 9 )
const ( // Amount of time to delay semaphore acquisition loops. MailboxDelaySleep time.Duration = 50 * time.Millisecond DefaultCtxDeadline time.Duration = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorString ¶ added in v0.1.1
type ColorString struct {
// contains filtered or unexported fields
}
func MakeColorString ¶ added in v0.1.1
func MakeColorString() *ColorString
func (*ColorString) SetAttr ¶ added in v0.1.1
func (cs *ColorString) SetAttr(attr int)
func (*ColorString) SetBG ¶ added in v0.1.1
func (cs *ColorString) SetBG(col int)
func (*ColorString) SetFG ¶ added in v0.1.1
func (cs *ColorString) SetFG(col int)
func (*ColorString) SetString ¶ added in v0.1.1
func (cs *ColorString) SetString(val string)
func (*ColorString) String ¶ added in v0.1.1
func (cs *ColorString) String() string
type Error ¶
Custom error structure.
This is compatible with the `error` interface and provides `Unwrap` support.
func NewErrorAndLog ¶
Create a new error object and immediately log it.
func (*Error) MarshalJSON ¶
Convert the error to a JSON string.
type Mailbox ¶
type Mailbox struct {
// contains filtered or unexported fields
}
Mailbox structure.
This is a cheap implementation of a mailbox.
It uses two semaphores to control read and write access, and contains a single datum.
This is *not* a queue!
func NewMailbox ¶
func NewMailbox() *Mailbox
Create and return a new empty mailbox.
Note: this acquires the `preventRead` semaphore.
func (*Mailbox) Get ¶
Get an element from the mailbox. Defaults to using a context with a deadline of 5 seconds.
func (*Mailbox) GetWithContext ¶
type Pair ¶
type Pair struct { First interface{} Second interface{} }
Pair structure.
This is a cheap implementation of a pair (aka two-value tuple).
I wish generics were a thing.