syncvar

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Var

type Var[T any] struct {
	// contains filtered or unexported fields
}

Var contains a variable of any type protected by a mutex

func New

func New[T any](value T) *Var[T]

New creates a new Var with specified value

func Zero

func Zero[T any]() *Var[T]

Zero creates a new Var with a zero value

func (*Var[T]) Get

func (v *Var[T]) Get() T

Get returns a value

func (*Var[T]) Set

func (v *Var[T]) Set(value T)

Set sets a value

func (*Var[T]) Swap

func (v *Var[T]) Swap(value T) T

Swap sets a new value and returns the previous value

Jump to

Keyboard shortcuts

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