Skip to content

Commit

Permalink
Add types/ptr.To
Browse files Browse the repository at this point in the history
  • Loading branch information
nickstenning committed Nov 8, 2024
1 parent 45e9ae8 commit 0eb9087
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions types/ptr/ptr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Package ptr contains a helper function for creating pointers to values.
package ptr

// To returns a pointer to a shallow copy of v.
func To[T any](v T) *T {
return &v
}

0 comments on commit 0eb9087

Please sign in to comment.