summaryrefslogtreecommitdiff
path: root/pool.go
diff options
context:
space:
mode:
Diffstat (limited to 'pool.go')
-rw-r--r--pool.go33
1 files changed, 0 insertions, 33 deletions
diff --git a/pool.go b/pool.go
deleted file mode 100644
index c196085..0000000
--- a/pool.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com>
-//
-// SPDX-License-Identifier: GPL-2.0-or-later
-
-package typedsync
-
-import (
- "sync"
-)
-
-type Pool[T any] struct {
- New func() T
-
- inner sync.Pool
-}
-
-func (p *Pool[T]) Get() (val T, ok bool) {
- _val := p.inner.Get()
- switch {
- case _val != nil:
- //nolint:forcetypeassert // Typed wrapper around untyped lib.
- return _val.(T), true
- case p.New != nil:
- return p.New(), true
- default:
- var zero T
- return zero, false
- }
-}
-
-func (p *Pool[T]) Put(val T) {
- p.inner.Put(val)
-}