primitive

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package primitive contains some primitives and helper functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collect

func Collect[K any](it iter.Seq2[K, error]) ([]K, error)

Collect collects all Ks from iterator it, returning any encountered error.

func FlagRender added in v4.0.2

func FlagRender(f uint8, flg [8]byte) string

FlagRender returns the representation of f using characters in flg.

func IfTrue

func IfTrue[T any](cond bool, t T, f T) T

IfTrue returns second argument if the condition is true, otherwise, returns the third one. Same as C's ternary condition operator:

cond ? t : f;

Types

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

Counter is the thread safe Counter.

func (*Counter) Add

func (c *Counter) Add(n int) int

func (*Counter) Dec

func (c *Counter) Dec() int

func (*Counter) Inc

func (c *Counter) Inc() int

func (*Counter) N

func (c *Counter) N() int

Jump to

Keyboard shortcuts

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