MCPcopy
hub / github.com/duke-git/lancet / Of

Function Of

pointer/pointer.go:13–18  ·  view source on GitHub ↗

Of returns a pointer to the value `v`. Play: https://go.dev/play/p/HFd70x4DrMj

(v T)

Source from the content-addressed store, hash-verified

11// Of returns a pointer to the value `v`.
12// Play: https://go.dev/play/p/HFd70x4DrMj
13func Of[T any](v T) *T {
14 if IsNil(v) {
15 return nil
16 }
17 return &v
18}
19
20// Unwrap returns the value from the pointer.
21//

Callers 2

ExampleOfFunction · 0.70
TestOfFunction · 0.70

Calls 1

IsNilFunction · 0.85

Tested by 2

ExampleOfFunction · 0.56
TestOfFunction · 0.56