Documentation
¶
Overview ¶
Package util 一些工具类与函数。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Face ¶
type Face[T any] struct { Iface T Cache IfaceCache }
Face 面,用于存储接口与其存储器,接口可用于断言转换类型,存储器可用于转换为接口
type IfaceCache ¶
IfaceCache 接口存储器,因为Golang原生的接口转换性能较差,所以在某些性能要求较高的场景(例如瞬时演算)下,需要尽量较少接口转换。 目前可用的优化方案是,在编码时明确知晓接口类型时,可以将接口转换为[2]unsafe.Pointer保存接口,使用时再转换为接口即可。 为了使用方便,本包提供了一套方法用于支持此类需求,注意不安全,在明确了解此功能时再使用。
var NilIfaceCache IfaceCache
NilIfaceCache 空接口存储器
Click to show internal directories.
Click to hide internal directories.