1
0
mirror of https://github.com/fumiama/orbyte.git synced 2026-06-05 02:00:30 +08:00

feat(item): add api Pointer

This commit is contained in:
源文雨
2025-02-25 00:03:52 +09:00
parent 17ba555622
commit ace08d6e6e

View File

@@ -46,6 +46,14 @@ func (b *Item[T]) Unwrap() T {
return b.val
}
// Pointer use pointer value of the item
func (b *Item[T]) Pointer() *T {
if b.stat.hasdestroyed() {
panic("use after destroy")
}
return &b.val
}
// Ref gens new item without ownership.
//
// It's a safe reference, thus calling this