Documentation
¶
Index ¶
- type Slice
- func (s *Slice[T]) Append(t T) (err error)
- func (s *Slice[T]) Close() (err error)
- func (s *Slice[T]) ForEach(fn func(T) (end bool)) (ended bool)
- func (s *Slice[T]) Get(index int) (kv T, err error)
- func (s *Slice[T]) InsertAt(index int, value T) (err error)
- func (s *Slice[T]) Len() int
- func (s *Slice[T]) RemoveAt(index int) (err error)
- func (s *Slice[T]) Set(index int, t T) (err error)
- func (s *Slice[T]) Slice() (out []T)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Slice ¶
type Slice[T any] struct { // contains filtered or unexported fields }
func New ¶
Example ¶
var err error
if exampleSlice, err = New[int]("myfile.bat"); err != nil {
// Handle error here
return
}
func (*Slice[T]) Append ¶
Example ¶
var err error
if err = exampleSlice.Append(1337); err != nil {
// Handle error here
return
}
func (*Slice[T]) ForEach ¶
Example ¶
exampleSlice.ForEach(func(v int) (end bool) {
fmt.Println("Value", v)
return
})
func (*Slice[T]) Get ¶
Example ¶
var (
v int
err error
)
if v, err = exampleSlice.Get(0); err != nil {
// Handle error here
return
}
fmt.Println("Value", v)
func (*Slice[T]) InsertAt ¶
Example ¶
var err error
if err = exampleSlice.InsertAt(0, 1337); err != nil {
// Handle error here
return
}
func (*Slice[T]) RemoveAt ¶
Example ¶
var err error
if err = exampleSlice.RemoveAt(0); err != nil {
// Handle error here
return
}
Click to show internal directories.
Click to hide internal directories.