1// Copyright 2021 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package a
6
7type Value[T any] struct {
8	val T
9}
10
11// The noinline directive should survive across import, and prevent instantiations
12// of these functions from being inlined.
13
14//go:noinline
15func Get[T any](v *Value[T]) T {
16	return v.val
17}
18
19//go:noinline
20func Set[T any](v *Value[T], val T) {
21	v.val = val
22}
23
24//go:noinline
25func (v *Value[T]) Set(val T) {
26	v.val = val
27}
28
29//go:noinline
30func (v *Value[T]) Get() T {
31	return v.val
32}
33