attributedstring

package
v0.57.6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Slice

type Slice struct {
	// Note that the fields below _must_ be exported.  Otherwise the TOML
	// encoder would fail during type reflection.
	Values     []string
	Attributes struct {
		Append *bool // Nil if not set by the user
	}
}

Slice allows for extending a TOML string array with custom attributes that control how the array is marshaled into a Go string.

Specifically, an Slice can be configured to avoid it being overridden by a subsequent unmarshal sequence. When the `append` attribute is specified, the array will be appended instead (e.g., `array=["9", {append=true}]`).

func NewSlice

func NewSlice(values []string) Slice

NewSlice creates a new slice with the specified values.

func (*Slice) Get

func (a *Slice) Get() []string

Get returns the Slice values or an empty string slice.

func (*Slice) MarshalTOML

func (a *Slice) MarshalTOML() ([]byte, error)

MarshalTOML is the custom marshal method for Slice.

func (*Slice) Set

func (a *Slice) Set(values []string)

Set overrides the values of the Slice.

func (*Slice) UnmarshalTOML

func (a *Slice) UnmarshalTOML(data interface{}) error

UnmarshalTOML is the custom unmarshal method for Slice.

Jump to

Keyboard shortcuts

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