kit

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply[T any](t *T, opts ...Option[T])

func ApplyErr

func ApplyErr[T any](t *T, opts ...OptionErr[T]) error

Types

type MapSet

type MapSet[T comparable] struct {
	// contains filtered or unexported fields
}

func NewMapSet

func NewMapSet[T comparable](size int) *MapSet[T]

func (*MapSet[T]) Add

func (s *MapSet[T]) Add(val T)

func (*MapSet[T]) Delete

func (s *MapSet[T]) Delete(key T)

func (*MapSet[T]) Exist

func (s *MapSet[T]) Exist(key T) bool

func (*MapSet[T]) Keys

func (s *MapSet[T]) Keys() []T

Keys 方法返回的元素顺序不固定

type Option

type Option[T any] func(t *T)

type OptionErr

type OptionErr[T any] func(t *T) error

type Set

type Set[T comparable] interface {
	Add(key T)
	Delete(key T)
	// Exist 返回是否存在这个元素
	Exist(key T) bool
	Keys() []T
}

Jump to

Keyboard shortcuts

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