poxa

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Unlicense Imports: 1 Imported by: 1

README

Spinner

Overview

Spinner is a simple and efficient Go package that provides a rotating/spinning data structure. It is implemented using Go's new generics feature, allowing it to hold elements of any type. Under the hood, it uses Go's container/ring package to maintain a circular list of elements.

Usage

go get github.com/twiny/poxa
package main

import (
	"fmt"
	"github.com/twiny/poxa"
)

func main() {
	sp := poxa.NewSpinner[int](1, 2, 3)

	for i := 0; i < 5; i++ {
		fmt.Println(sp.Next())
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spinner

type Spinner[T any] interface {
	Next() T
}

func NewSpinner

func NewSpinner[T any](elems ...T) Spinner[T]

Jump to

Keyboard shortcuts

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