resourcePool

package
v0.2.0-2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnySlices = newSlicePool[any](20)

AnySlices any切片池

View Source
var FieldSlices = newSlicePool[fuzzTypes.Field](20)
View Source
var IntSlices = newSlicePool[int](20)

IntSlices int切片池

View Source
var StringSlices = newSlicePool[string](20)

StringSlices 字符串切片池

Functions

func GetNewReaction

func GetNewReaction() *fuzzTypes.Reaction

GetNewReaction 从池中获取一个新的Reaction结构

func GetNewReq

func GetNewReq() *fuzzTypes.Req

GetNewReq 从池中获取一个新的Req结构,并使用originalReq复制

func PutReaction

func PutReaction(r *fuzzTypes.Reaction)

PutReaction 将用完的Reaction结构放回池

func PutReq

func PutReq(r *fuzzTypes.Req)

PutReq 放回用完的Req结构

Types

type SlicePool

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

SlicePool 通用切片对象池,支持任意类型切片[]T

func (*SlicePool[T]) Get

func (p *SlicePool[T]) Get(length int) []T

Get 从池中获取长度为length的切片 length < 0 时返回nil

func (*SlicePool[T]) Put

func (p *SlicePool[T]) Put(slice []T)

Put 将使用完毕的切片放回池中(截断为长度0以保留容量)

Jump to

Keyboard shortcuts

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