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:
8
item.go
8
item.go
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user