mirror of
https://github.com/fumiama/orbyte.git
synced 2026-06-20 02:30:26 +08:00
feat(pbuf): add more defs
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
|||||||
var bufferPool = NewBufferPool[struct{}]()
|
var bufferPool = NewBufferPool[struct{}]()
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
Pool = BufferPool[struct{}]
|
||||||
OBuffer = orbyte.Item[Buffer]
|
OBuffer = orbyte.Item[Buffer]
|
||||||
Buffer = UserBuffer[struct{}]
|
Buffer = UserBuffer[struct{}]
|
||||||
Bytes = UserBytes[struct{}]
|
Bytes = UserBytes[struct{}]
|
||||||
@@ -19,6 +20,11 @@ type BufferPool[USRDAT any] struct {
|
|||||||
*orbyte.Pool[UserBuffer[USRDAT]]
|
*orbyte.Pool[UserBuffer[USRDAT]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDefaultBufferPool exposes inner bufferPool value.
|
||||||
|
func GetDefaultBufferPool() Pool {
|
||||||
|
return bufferPool
|
||||||
|
}
|
||||||
|
|
||||||
func NewBufferPool[USRDAT any]() BufferPool[USRDAT] {
|
func NewBufferPool[USRDAT any]() BufferPool[USRDAT] {
|
||||||
return BufferPool[USRDAT]{
|
return BufferPool[USRDAT]{
|
||||||
orbyte.NewPool[UserBuffer[USRDAT]](bufpooler[USRDAT]{}),
|
orbyte.NewPool[UserBuffer[USRDAT]](bufpooler[USRDAT]{}),
|
||||||
|
|||||||
Reference in New Issue
Block a user