package
module
Version:
v0.0.2
Opens a new window with list of versions in this module.
Published: Aug 16, 2025
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
gmx

Generic Mutex container types for Go, inspired by Rust's
Mutex and
RwLock.
It uses new language features introduced since go1.18:
-
generic type
-
generic interface
-
generic function
Documentation
¶
Generic Mutex container types for Go, inspired by Rust's Mutex and RwLock.
type Mutation[T any] func(*T)
Mutation represents mutable operation on a pointer
type Mutexer[T any] interface {
Mut(Mutation[T])
Get() T
}
Mutexer is implemented by Mx and RwMx
Generic Mutex container type
func Wrap[T any](x *T) *Mx[T]
Wrap a pointer into Mx
Get value referenced by the wrapped pointer
Mutate wrapped value guarded by sync.RWMutex
Generic Read-Write Mutex container type
func (m *RwMx[T]) Get() T
Get value referenced by the wrapped pointer
Mutate wrapped value guarded by sync.RWMutex
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.