Skip to content

Commit 659c56f

Browse files
authored
Update dependency_injection.go, add Ptr
add Ptr
1 parent ac6cbe8 commit 659c56f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

dependency_injection/dependency_injection.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,8 @@ func Any[T any](di *DependencyInjection, res *T) error {
105105
}
106106
return ErrDependencyNotFound
107107
}
108+
109+
// Ptr returns the pointer to any variable. Useful to make reference to values returned by MustAny() or MustNeed()
110+
func Ptr[T any](val T) *T {
111+
return &val
112+
}

0 commit comments

Comments
 (0)