package tests
import "tailscale.com/cmd/viewer/tests"
Package tests serves a list of tests for tailscale.com/cmd/viewer.
Index ¶
- type BasicType
- type Container
- type ContainerView
- func ContainerViewOf[T views.ViewCloner[T, V], V views.StructView[T]](c *Container[T]) ContainerView[T, V]
- func (cv ContainerView[T, V]) Item() V
- type GenericBasicStruct
- type GenericCloneableStruct
- func (src *GenericCloneableStruct[T, V]) Clone() *GenericCloneableStruct[T, V]
- func (p *GenericCloneableStruct[T, V]) View() GenericCloneableStructView[T, V]
- type GenericCloneableStructView
- func (v GenericCloneableStructView[T, V]) AsStruct() *GenericCloneableStruct[T, V]
- func (v GenericCloneableStructView[T, V]) Map() views.MapFn[string, T, V]
- func (v GenericCloneableStructView[T, V]) MarshalJSON() ([]byte, error)
- func (v GenericCloneableStructView[T, V]) Pointer() map[string]T
- func (v GenericCloneableStructView[T, V]) PtrKeyMap() map[*T]string
- func (v GenericCloneableStructView[T, V]) PtrSlice() *T
- func (v GenericCloneableStructView[T, V]) PtrValueMap() map[string]*T
- func (v GenericCloneableStructView[T, V]) Slice() views.SliceView[T, V]
- func (v GenericCloneableStructView[T, V]) SliceMap() map[string][]T
- func (v *GenericCloneableStructView[T, V]) UnmarshalJSON(b []byte) error
- func (v GenericCloneableStructView[T, V]) Valid() bool
- func (v GenericCloneableStructView[T, V]) Value() V
- type GenericIntStruct
- func (src *GenericIntStruct[T]) Clone() *GenericIntStruct[T]
- func (p *GenericIntStruct[T]) View() GenericIntStructView[T]
- type GenericIntStructView
- func (v GenericIntStructView[T]) AsStruct() *GenericIntStruct[T]
- func (v GenericIntStructView[T]) Map() views.Map[string, T]
- func (v GenericIntStructView[T]) MarshalJSON() ([]byte, error)
- func (v GenericIntStructView[T]) Pointer() views.ValuePointer[T]
- func (v GenericIntStructView[T]) PtrKeyMap() map[*T]string
- func (v GenericIntStructView[T]) PtrSlice() *T
- func (v GenericIntStructView[T]) PtrValueMap() map[string]*T
- func (v GenericIntStructView[T]) Slice() views.Slice[T]
- func (v GenericIntStructView[T]) SliceMap() map[string][]T
- func (v *GenericIntStructView[T]) UnmarshalJSON(b []byte) error
- func (v GenericIntStructView[T]) Valid() bool
- func (v GenericIntStructView[T]) Value() T
- type GenericNoPtrsStruct
- func (src *GenericNoPtrsStruct[T]) Clone() *GenericNoPtrsStruct[T]
- func (p *GenericNoPtrsStruct[T]) View() GenericNoPtrsStructView[T]
- type GenericNoPtrsStructView
- func (v GenericNoPtrsStructView[T]) AsStruct() *GenericNoPtrsStruct[T]
- func (v GenericNoPtrsStructView[T]) Map() views.Map[string, T]
- func (v GenericNoPtrsStructView[T]) MarshalJSON() ([]byte, error)
- func (v GenericNoPtrsStructView[T]) Pointer() views.ValuePointer[T]
- func (v GenericNoPtrsStructView[T]) PtrKeyMap() map[*T]string
- func (v GenericNoPtrsStructView[T]) PtrSlice() *T
- func (v GenericNoPtrsStructView[T]) PtrValueMap() map[string]*T
- func (v GenericNoPtrsStructView[T]) Slice() views.Slice[T]
- func (v GenericNoPtrsStructView[T]) SliceMap() map[string][]T
- func (v *GenericNoPtrsStructView[T]) UnmarshalJSON(b []byte) error
- func (v GenericNoPtrsStructView[T]) Valid() bool
- func (v GenericNoPtrsStructView[T]) Value() T
- type GenericTypeAliasStruct
- func (src *GenericTypeAliasStruct[T, T2, V2]) Clone() *GenericTypeAliasStruct[T, T2, V2]
- func (p *GenericTypeAliasStruct[T, T2, V2]) View() GenericTypeAliasStructView[T, T2, V2]
- type GenericTypeAliasStructView
- func (v GenericTypeAliasStructView[T, T2, V2]) AsStruct() *GenericTypeAliasStruct[T, T2, V2]
- func (v GenericTypeAliasStructView[T, T2, V2]) Cloneable() V2
- func (v GenericTypeAliasStructView[T, T2, V2]) MarshalJSON() ([]byte, error)
- func (v GenericTypeAliasStructView[T, T2, V2]) NonCloneable() T
- func (v *GenericTypeAliasStructView[T, T2, V2]) UnmarshalJSON(b []byte) error
- func (v GenericTypeAliasStructView[T, T2, V2]) Valid() bool
- type Map
- type MapContainer
- type MapContainerView
- func MapContainerViewOf[K comparable, T views.ViewCloner[T, V], V views.StructView[T]](c *MapContainer[K, T]) MapContainerView[K, T, V]
- func (cv MapContainerView[K, T, V]) Items() views.MapFn[K, T, V]
- type MapView
- func (v MapView) AsStruct() *Map
- func (v MapView) Int() views.Map[string, int]
- func (v MapView) MarshalJSON() ([]byte, error)
- func (v MapView) PointerKey() map[*string]int
- func (v MapView) SliceInt() views.MapSlice[string, int]
- func (v MapView) SliceIntPtr() map[string][]*int
- func (v MapView) SlicesWithPtrs() views.MapFn[string, []*StructWithPtrs, views.SliceView[*StructWithPtrs, StructWithPtrsView]]
- func (v MapView) SlicesWithoutPtrs() views.MapFn[string, []*StructWithoutPtrs, views.SliceView[*StructWithoutPtrs, StructWithoutPtrsView]]
- func (v MapView) StructPtrWithPtr() views.MapFn[string, *StructWithPtrs, StructWithPtrsView]
- func (v MapView) StructPtrWithoutPtr() views.MapFn[string, *StructWithoutPtrs, StructWithoutPtrsView]
- func (v MapView) StructWithPtr() views.MapFn[string, StructWithPtrs, StructWithPtrsView]
- func (v MapView) StructWithPtrKey() map[StructWithPtrs]int
- func (v MapView) StructWithoutPtr() views.Map[string, StructWithoutPtrs]
- func (v MapView) StructWithoutPtrKey() views.Map[StructWithoutPtrs, int]
- func (v *MapView) UnmarshalJSON(b []byte) error
- func (v MapView) Valid() bool
- type OnlyGetClone
- type StructWithContainers
- func (src *StructWithContainers) Clone() *StructWithContainers
- func (p *StructWithContainers) View() StructWithContainersView
- type StructWithContainersView
- func (v StructWithContainersView) AsStruct() *StructWithContainers
- func (v StructWithContainersView) BasicGenericContainer() Container[GenericBasicStruct[int]]
- func (v StructWithContainersView) CloneableContainer() ContainerView[*StructWithPtrs, StructWithPtrsView]
- func (v StructWithContainersView) CloneableGenericContainer() ContainerView[*GenericNoPtrsStruct[int], GenericNoPtrsStructView[int]]
- func (v StructWithContainersView) CloneableGenericMap() MapContainerView[int, *GenericNoPtrsStruct[int], GenericNoPtrsStructView[int]]
- func (v StructWithContainersView) CloneableMap() MapContainerView[int, *StructWithPtrs, StructWithPtrsView]
- func (v StructWithContainersView) IntContainer() Container[int]
- func (v StructWithContainersView) MarshalJSON() ([]byte, error)
- func (v *StructWithContainersView) UnmarshalJSON(b []byte) error
- func (v StructWithContainersView) Valid() bool
- type StructWithEmbedded
- func (src *StructWithEmbedded) Clone() *StructWithEmbedded
- func (p *StructWithEmbedded) View() StructWithEmbeddedView
- type StructWithEmbeddedView
- func (v StructWithEmbeddedView) A() StructWithPtrsView
- func (v StructWithEmbeddedView) AsStruct() *StructWithEmbedded
- func (v StructWithEmbeddedView) MarshalJSON() ([]byte, error)
- func (v StructWithEmbeddedView) StructWithSlices() StructWithSlicesView
- func (v *StructWithEmbeddedView) UnmarshalJSON(b []byte) error
- func (v StructWithEmbeddedView) Valid() bool
- type StructWithNoView
- type StructWithPtrs
- func (src *StructWithPtrs) Clone() *StructWithPtrs
- func (v *StructWithPtrs) Equal(v2 *StructWithPtrs) bool
- func (v *StructWithPtrs) String() string
- func (p *StructWithPtrs) View() StructWithPtrsView
- type StructWithPtrsAlias
- type StructWithPtrsAliasView
- type StructWithPtrsView
- func (v StructWithPtrsView) AsStruct() *StructWithPtrs
- func (v StructWithPtrsView) Equal(v2 StructWithPtrsView) bool
- func (v StructWithPtrsView) Int() views.ValuePointer[int]
- func (v StructWithPtrsView) MarshalJSON() ([]byte, error)
- func (v StructWithPtrsView) NoCloneValue() *StructWithoutPtrs
- func (v StructWithPtrsView) NoView() views.ValuePointer[StructWithNoView]
- func (v StructWithPtrsView) String() string
- func (v *StructWithPtrsView) UnmarshalJSON(b []byte) error
- func (v StructWithPtrsView) Valid() bool
- func (v StructWithPtrsView) Value() StructWithoutPtrsView
- type StructWithSlices
- func (src *StructWithSlices) Clone() *StructWithSlices
- func (p *StructWithSlices) View() StructWithSlicesView
- type StructWithSlicesView
- func (v StructWithSlicesView) AsStruct() *StructWithSlices
- func (v StructWithSlicesView) Data() views.ByteSlice[[]byte]
- func (v StructWithSlicesView) Ints() *int
- func (v StructWithSlicesView) MarshalJSON() ([]byte, error)
- func (v StructWithSlicesView) Prefixes() views.Slice[netip.Prefix]
- func (v StructWithSlicesView) Slice() views.Slice[string]
- func (v StructWithSlicesView) StructPointers() views.SliceView[*StructWithPtrs, StructWithPtrsView]
- func (v StructWithSlicesView) Structs() StructWithPtrs
- func (v *StructWithSlicesView) UnmarshalJSON(b []byte) error
- func (v StructWithSlicesView) Valid() bool
- func (v StructWithSlicesView) ValuePointers() views.SliceView[*StructWithoutPtrs, StructWithoutPtrsView]
- func (v StructWithSlicesView) Values() views.Slice[StructWithoutPtrs]
- type StructWithTypeAliasFields
- func (src *StructWithTypeAliasFields) Clone() *StructWithTypeAliasFields
- func (p *StructWithTypeAliasFields) View() StructWithTypeAliasFieldsView
- type StructWithTypeAliasFieldsView
- func (v StructWithTypeAliasFieldsView) AsStruct() *StructWithTypeAliasFields
- func (v StructWithTypeAliasFieldsView) MapOfSlicesWithPtrs() views.MapFn[string, []*StructWithPtrsAlias, views.SliceView[*StructWithPtrsAlias, StructWithPtrsAliasView]]
- func (v StructWithTypeAliasFieldsView) MapOfSlicesWithoutPtrs() views.MapFn[string, []*StructWithoutPtrsAlias, views.SliceView[*StructWithoutPtrsAlias, StructWithoutPtrsAliasView]]
- func (v StructWithTypeAliasFieldsView) MapWithPtrs() views.MapFn[string, *StructWithPtrsAlias, StructWithPtrsAliasView]
- func (v StructWithTypeAliasFieldsView) MapWithoutPtrs() views.MapFn[string, *StructWithoutPtrsAlias, StructWithoutPtrsAliasView]
- func (v StructWithTypeAliasFieldsView) MarshalJSON() ([]byte, error)
- func (v StructWithTypeAliasFieldsView) SliceWithPtrs() views.SliceView[*StructWithPtrsAlias, StructWithPtrsAliasView]
- func (v StructWithTypeAliasFieldsView) SliceWithoutPtrs() views.SliceView[*StructWithoutPtrsAlias, StructWithoutPtrsAliasView]
- func (v *StructWithTypeAliasFieldsView) UnmarshalJSON(b []byte) error
- func (v StructWithTypeAliasFieldsView) Valid() bool
- func (v StructWithTypeAliasFieldsView) WithPtr() StructWithPtrsAliasView
- func (v StructWithTypeAliasFieldsView) WithPtrByPtr() StructWithPtrsAliasView
- func (v StructWithTypeAliasFieldsView) WithoutPtr() StructWithoutPtrsAlias
- func (v StructWithTypeAliasFieldsView) WithoutPtrByPtr() StructWithoutPtrsAliasView
- type StructWithoutPtrs
- func (src *StructWithoutPtrs) Clone() *StructWithoutPtrs
- func (p *StructWithoutPtrs) View() StructWithoutPtrsView
- type StructWithoutPtrsAlias
- type StructWithoutPtrsAliasView
- type StructWithoutPtrsView
- func (v StructWithoutPtrsView) AsStruct() *StructWithoutPtrs
- func (v StructWithoutPtrsView) Int() int
- func (v StructWithoutPtrsView) MarshalJSON() ([]byte, error)
- func (v StructWithoutPtrsView) Pfx() netip.Prefix
- func (v *StructWithoutPtrsView) UnmarshalJSON(b []byte) error
- func (v StructWithoutPtrsView) Valid() bool
Types ¶
type BasicType ¶
type BasicType interface { ~bool | constraints.Integer | constraints.Float | constraints.Complex | ~string }
type Container ¶
type Container[T any] struct { Item T }
Container is a pre-defined container type, such as a collection, an optional value or a generic wrapper.
func (*Container[T]) Clone ¶
type ContainerView ¶
type ContainerView[T views.ViewCloner[T, V], V views.StructView[T]] struct { // contains filtered or unexported fields }
ContainerView is a pre-defined read-only view of a Container[T].
func ContainerViewOf ¶
func ContainerViewOf[T views.ViewCloner[T, V], V views.StructView[T]](c *Container[T]) ContainerView[T, V]
func (ContainerView[T, V]) Item ¶
func (cv ContainerView[T, V]) Item() V
type GenericBasicStruct ¶
type GenericBasicStruct[T BasicType] struct { Value T }
type GenericCloneableStruct ¶
type GenericCloneableStruct[T views.ViewCloner[T, V], V views.StructView[T]] struct { Value T Slice []T Map map[string]T // Unsupported views. Pointer *T PtrSlice []*T PtrKeyMap map[*T]string `json:"-"` PtrValueMap map[string]*T SliceMap map[string][]T }
func (*GenericCloneableStruct[T, V]) Clone ¶
func (src *GenericCloneableStruct[T, V]) Clone() *GenericCloneableStruct[T, V]
Clone makes a deep copy of GenericCloneableStruct. The result aliases no memory with the original.
func (*GenericCloneableStruct[T, V]) View ¶
func (p *GenericCloneableStruct[T, V]) View() GenericCloneableStructView[T, V]
View returns a read-only view of GenericCloneableStruct.
type GenericCloneableStructView ¶
type GenericCloneableStructView[T views.ViewCloner[T, V], V views.StructView[T]] struct { // contains filtered or unexported fields }
GenericCloneableStructView[T, V] provides a read-only view over GenericCloneableStruct[T, V].
Its methods should only be called if `Valid()` returns true.
func (GenericCloneableStructView[T, V]) AsStruct ¶
func (v GenericCloneableStructView[T, V]) AsStruct() *GenericCloneableStruct[T, V]
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (GenericCloneableStructView[T, V]) Map ¶
func (v GenericCloneableStructView[T, V]) Map() views.MapFn[string, T, V]
func (GenericCloneableStructView[T, V]) MarshalJSON ¶
func (v GenericCloneableStructView[T, V]) MarshalJSON() ([]byte, error)
func (GenericCloneableStructView[T, V]) Pointer ¶
func (v GenericCloneableStructView[T, V]) Pointer() map[string]T
func (GenericCloneableStructView[T, V]) PtrKeyMap ¶
func (v GenericCloneableStructView[T, V]) PtrKeyMap() map[*T]string
func (GenericCloneableStructView[T, V]) PtrSlice ¶
func (v GenericCloneableStructView[T, V]) PtrSlice() *T
func (GenericCloneableStructView[T, V]) PtrValueMap ¶
func (v GenericCloneableStructView[T, V]) PtrValueMap() map[string]*T
func (GenericCloneableStructView[T, V]) Slice ¶
func (v GenericCloneableStructView[T, V]) Slice() views.SliceView[T, V]
func (GenericCloneableStructView[T, V]) SliceMap ¶
func (v GenericCloneableStructView[T, V]) SliceMap() map[string][]T
func (*GenericCloneableStructView[T, V]) UnmarshalJSON ¶
func (v *GenericCloneableStructView[T, V]) UnmarshalJSON(b []byte) error
func (GenericCloneableStructView[T, V]) Valid ¶
func (v GenericCloneableStructView[T, V]) Valid() bool
Valid reports whether v's underlying value is non-nil.
func (GenericCloneableStructView[T, V]) Value ¶
func (v GenericCloneableStructView[T, V]) Value() V
type GenericIntStruct ¶
type GenericIntStruct[T constraints.Integer] struct { Value T Pointer *T Slice []T Map map[string]T // Unsupported views. PtrSlice []*T PtrKeyMap map[*T]string `json:"-"` PtrValueMap map[string]*T SliceMap map[string][]T }
func (*GenericIntStruct[T]) Clone ¶
func (src *GenericIntStruct[T]) Clone() *GenericIntStruct[T]
Clone makes a deep copy of GenericIntStruct. The result aliases no memory with the original.
func (*GenericIntStruct[T]) View ¶
func (p *GenericIntStruct[T]) View() GenericIntStructView[T]
View returns a read-only view of GenericIntStruct.
type GenericIntStructView ¶
type GenericIntStructView[T constraints.Integer] struct { // contains filtered or unexported fields }
GenericIntStructView[T] provides a read-only view over GenericIntStruct[T].
Its methods should only be called if `Valid()` returns true.
func (GenericIntStructView[T]) AsStruct ¶
func (v GenericIntStructView[T]) AsStruct() *GenericIntStruct[T]
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (GenericIntStructView[T]) Map ¶
func (v GenericIntStructView[T]) Map() views.Map[string, T]
func (GenericIntStructView[T]) MarshalJSON ¶
func (v GenericIntStructView[T]) MarshalJSON() ([]byte, error)
func (GenericIntStructView[T]) Pointer ¶
func (v GenericIntStructView[T]) Pointer() views.ValuePointer[T]
func (GenericIntStructView[T]) PtrKeyMap ¶
func (v GenericIntStructView[T]) PtrKeyMap() map[*T]string
func (GenericIntStructView[T]) PtrSlice ¶
func (v GenericIntStructView[T]) PtrSlice() *T
func (GenericIntStructView[T]) PtrValueMap ¶
func (v GenericIntStructView[T]) PtrValueMap() map[string]*T
func (GenericIntStructView[T]) Slice ¶
func (v GenericIntStructView[T]) Slice() views.Slice[T]
func (GenericIntStructView[T]) SliceMap ¶
func (v GenericIntStructView[T]) SliceMap() map[string][]T
func (*GenericIntStructView[T]) UnmarshalJSON ¶
func (v *GenericIntStructView[T]) UnmarshalJSON(b []byte) error
func (GenericIntStructView[T]) Valid ¶
func (v GenericIntStructView[T]) Valid() bool
Valid reports whether v's underlying value is non-nil.
func (GenericIntStructView[T]) Value ¶
func (v GenericIntStructView[T]) Value() T
type GenericNoPtrsStruct ¶
type GenericNoPtrsStruct[T StructWithoutPtrs | netip.Prefix | BasicType] struct { Value T Pointer *T Slice []T Map map[string]T // Unsupported views. PtrSlice []*T PtrKeyMap map[*T]string `json:"-"` PtrValueMap map[string]*T SliceMap map[string][]T }
func (*GenericNoPtrsStruct[T]) Clone ¶
func (src *GenericNoPtrsStruct[T]) Clone() *GenericNoPtrsStruct[T]
Clone makes a deep copy of GenericNoPtrsStruct. The result aliases no memory with the original.
func (*GenericNoPtrsStruct[T]) View ¶
func (p *GenericNoPtrsStruct[T]) View() GenericNoPtrsStructView[T]
View returns a read-only view of GenericNoPtrsStruct.
type GenericNoPtrsStructView ¶
type GenericNoPtrsStructView[T StructWithoutPtrs | netip.Prefix | BasicType] struct { // contains filtered or unexported fields }
GenericNoPtrsStructView[T] provides a read-only view over GenericNoPtrsStruct[T].
Its methods should only be called if `Valid()` returns true.
func (GenericNoPtrsStructView[T]) AsStruct ¶
func (v GenericNoPtrsStructView[T]) AsStruct() *GenericNoPtrsStruct[T]
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (GenericNoPtrsStructView[T]) Map ¶
func (v GenericNoPtrsStructView[T]) Map() views.Map[string, T]
func (GenericNoPtrsStructView[T]) MarshalJSON ¶
func (v GenericNoPtrsStructView[T]) MarshalJSON() ([]byte, error)
func (GenericNoPtrsStructView[T]) Pointer ¶
func (v GenericNoPtrsStructView[T]) Pointer() views.ValuePointer[T]
func (GenericNoPtrsStructView[T]) PtrKeyMap ¶
func (v GenericNoPtrsStructView[T]) PtrKeyMap() map[*T]string
func (GenericNoPtrsStructView[T]) PtrSlice ¶
func (v GenericNoPtrsStructView[T]) PtrSlice() *T
func (GenericNoPtrsStructView[T]) PtrValueMap ¶
func (v GenericNoPtrsStructView[T]) PtrValueMap() map[string]*T
func (GenericNoPtrsStructView[T]) Slice ¶
func (v GenericNoPtrsStructView[T]) Slice() views.Slice[T]
func (GenericNoPtrsStructView[T]) SliceMap ¶
func (v GenericNoPtrsStructView[T]) SliceMap() map[string][]T
func (*GenericNoPtrsStructView[T]) UnmarshalJSON ¶
func (v *GenericNoPtrsStructView[T]) UnmarshalJSON(b []byte) error
func (GenericNoPtrsStructView[T]) Valid ¶
func (v GenericNoPtrsStructView[T]) Valid() bool
Valid reports whether v's underlying value is non-nil.
func (GenericNoPtrsStructView[T]) Value ¶
func (v GenericNoPtrsStructView[T]) Value() T
type GenericTypeAliasStruct ¶
type GenericTypeAliasStruct[T integer, T2 views.ViewCloner[T2, V2], V2 views.StructView[T2]] struct { NonCloneable T Cloneable T2 }
func (*GenericTypeAliasStruct[T, T2, V2]) Clone ¶
func (src *GenericTypeAliasStruct[T, T2, V2]) Clone() *GenericTypeAliasStruct[T, T2, V2]
Clone makes a deep copy of GenericTypeAliasStruct. The result aliases no memory with the original.
func (*GenericTypeAliasStruct[T, T2, V2]) View ¶
func (p *GenericTypeAliasStruct[T, T2, V2]) View() GenericTypeAliasStructView[T, T2, V2]
View returns a read-only view of GenericTypeAliasStruct.
type GenericTypeAliasStructView ¶
type GenericTypeAliasStructView[T integer, T2 views.ViewCloner[T2, V2], V2 views.StructView[T2]] struct { // contains filtered or unexported fields }
GenericTypeAliasStructView[T, T2, V2] provides a read-only view over GenericTypeAliasStruct[T, T2, V2].
Its methods should only be called if `Valid()` returns true.
func (GenericTypeAliasStructView[T, T2, V2]) AsStruct ¶
func (v GenericTypeAliasStructView[T, T2, V2]) AsStruct() *GenericTypeAliasStruct[T, T2, V2]
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (GenericTypeAliasStructView[T, T2, V2]) Cloneable ¶
func (v GenericTypeAliasStructView[T, T2, V2]) Cloneable() V2
func (GenericTypeAliasStructView[T, T2, V2]) MarshalJSON ¶
func (v GenericTypeAliasStructView[T, T2, V2]) MarshalJSON() ([]byte, error)
func (GenericTypeAliasStructView[T, T2, V2]) NonCloneable ¶
func (v GenericTypeAliasStructView[T, T2, V2]) NonCloneable() T
func (*GenericTypeAliasStructView[T, T2, V2]) UnmarshalJSON ¶
func (v *GenericTypeAliasStructView[T, T2, V2]) UnmarshalJSON(b []byte) error
func (GenericTypeAliasStructView[T, T2, V2]) Valid ¶
func (v GenericTypeAliasStructView[T, T2, V2]) Valid() bool
Valid reports whether v's underlying value is non-nil.
type Map ¶
type Map struct { Int map[string]int SliceInt map[string][]int StructPtrWithPtr map[string]*StructWithPtrs StructPtrWithoutPtr map[string]*StructWithoutPtrs StructWithoutPtr map[string]StructWithoutPtrs SlicesWithPtrs map[string][]*StructWithPtrs SlicesWithoutPtrs map[string][]*StructWithoutPtrs StructWithoutPtrKey map[StructWithoutPtrs]int `json:"-"` StructWithPtr map[string]StructWithPtrs // Unsupported views. SliceIntPtr map[string][]*int PointerKey map[*string]int `json:"-"` StructWithPtrKey map[StructWithPtrs]int `json:"-"` }
func (*Map) Clone ¶
Clone makes a deep copy of Map. The result aliases no memory with the original.
func (*Map) View ¶
View returns a read-only view of Map.
type MapContainer ¶
type MapContainer[K comparable, V views.Cloner[V]] struct { Items map[K]V }
MapContainer is a predefined map-like container type. Unlike Container, it has two type parameters, where the value is the second parameter.
func (*MapContainer[K, V]) Clone ¶
func (c *MapContainer[K, V]) Clone() *MapContainer[K, V]
type MapContainerView ¶
type MapContainerView[K comparable, T views.ViewCloner[T, V], V views.StructView[T]] struct { // contains filtered or unexported fields }
MapContainerView is a pre-defined read-only view of a MapContainer[K, T].
func MapContainerViewOf ¶
func MapContainerViewOf[K comparable, T views.ViewCloner[T, V], V views.StructView[T]](c *MapContainer[K, T]) MapContainerView[K, T, V]
func (MapContainerView[K, T, V]) Items ¶
func (cv MapContainerView[K, T, V]) Items() views.MapFn[K, T, V]
type MapView ¶
type MapView struct {
// contains filtered or unexported fields
}
MapView provides a read-only view over Map.
Its methods should only be called if `Valid()` returns true.
func (MapView) AsStruct ¶
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (MapView) Int ¶
func (MapView) MarshalJSON ¶
func (MapView) PointerKey ¶
func (MapView) SliceInt ¶
func (MapView) SliceIntPtr ¶
func (MapView) SlicesWithPtrs ¶
func (v MapView) SlicesWithPtrs() views.MapFn[string, []*StructWithPtrs, views.SliceView[*StructWithPtrs, StructWithPtrsView]]
func (MapView) SlicesWithoutPtrs ¶
func (v MapView) SlicesWithoutPtrs() views.MapFn[string, []*StructWithoutPtrs, views.SliceView[*StructWithoutPtrs, StructWithoutPtrsView]]
func (MapView) StructPtrWithPtr ¶
func (v MapView) StructPtrWithPtr() views.MapFn[string, *StructWithPtrs, StructWithPtrsView]
func (MapView) StructPtrWithoutPtr ¶
func (v MapView) StructPtrWithoutPtr() views.MapFn[string, *StructWithoutPtrs, StructWithoutPtrsView]
func (MapView) StructWithPtr ¶
func (v MapView) StructWithPtr() views.MapFn[string, StructWithPtrs, StructWithPtrsView]
func (MapView) StructWithPtrKey ¶
func (v MapView) StructWithPtrKey() map[StructWithPtrs]int
func (MapView) StructWithoutPtr ¶
func (v MapView) StructWithoutPtr() views.Map[string, StructWithoutPtrs]
func (MapView) StructWithoutPtrKey ¶
func (v MapView) StructWithoutPtrKey() views.Map[StructWithoutPtrs, int]
func (*MapView) UnmarshalJSON ¶
func (MapView) Valid ¶
Valid reports whether v's underlying value is non-nil.
type OnlyGetClone ¶
type OnlyGetClone struct { SinViewerPorFavor bool }
func (*OnlyGetClone) Clone ¶
func (src *OnlyGetClone) Clone() *OnlyGetClone
Clone makes a deep copy of OnlyGetClone. The result aliases no memory with the original.
type StructWithContainers ¶
type StructWithContainers struct { IntContainer Container[int] CloneableContainer Container[*StructWithPtrs] BasicGenericContainer Container[GenericBasicStruct[int]] CloneableGenericContainer Container[*GenericNoPtrsStruct[int]] CloneableMap MapContainer[int, *StructWithPtrs] CloneableGenericMap MapContainer[int, *GenericNoPtrsStruct[int]] }
func (*StructWithContainers) Clone ¶
func (src *StructWithContainers) Clone() *StructWithContainers
Clone makes a deep copy of StructWithContainers. The result aliases no memory with the original.
func (*StructWithContainers) View ¶
func (p *StructWithContainers) View() StructWithContainersView
View returns a read-only view of StructWithContainers.
type StructWithContainersView ¶
type StructWithContainersView struct {
// contains filtered or unexported fields
}
StructWithContainersView provides a read-only view over StructWithContainers.
Its methods should only be called if `Valid()` returns true.
func (StructWithContainersView) AsStruct ¶
func (v StructWithContainersView) AsStruct() *StructWithContainers
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (StructWithContainersView) BasicGenericContainer ¶
func (v StructWithContainersView) BasicGenericContainer() Container[GenericBasicStruct[int]]
func (StructWithContainersView) CloneableContainer ¶
func (v StructWithContainersView) CloneableContainer() ContainerView[*StructWithPtrs, StructWithPtrsView]
func (StructWithContainersView) CloneableGenericContainer ¶
func (v StructWithContainersView) CloneableGenericContainer() ContainerView[*GenericNoPtrsStruct[int], GenericNoPtrsStructView[int]]
func (StructWithContainersView) CloneableGenericMap ¶
func (v StructWithContainersView) CloneableGenericMap() MapContainerView[int, *GenericNoPtrsStruct[int], GenericNoPtrsStructView[int]]
func (StructWithContainersView) CloneableMap ¶
func (v StructWithContainersView) CloneableMap() MapContainerView[int, *StructWithPtrs, StructWithPtrsView]
func (StructWithContainersView) IntContainer ¶
func (v StructWithContainersView) IntContainer() Container[int]
func (StructWithContainersView) MarshalJSON ¶
func (v StructWithContainersView) MarshalJSON() ([]byte, error)
func (*StructWithContainersView) UnmarshalJSON ¶
func (v *StructWithContainersView) UnmarshalJSON(b []byte) error
func (StructWithContainersView) Valid ¶
func (v StructWithContainersView) Valid() bool
Valid reports whether v's underlying value is non-nil.
type StructWithEmbedded ¶
type StructWithEmbedded struct { A *StructWithPtrs StructWithSlices }
func (*StructWithEmbedded) Clone ¶
func (src *StructWithEmbedded) Clone() *StructWithEmbedded
Clone makes a deep copy of StructWithEmbedded. The result aliases no memory with the original.
func (*StructWithEmbedded) View ¶
func (p *StructWithEmbedded) View() StructWithEmbeddedView
View returns a read-only view of StructWithEmbedded.
type StructWithEmbeddedView ¶
type StructWithEmbeddedView struct {
// contains filtered or unexported fields
}
StructWithEmbeddedView provides a read-only view over StructWithEmbedded.
Its methods should only be called if `Valid()` returns true.
func (StructWithEmbeddedView) A ¶
func (v StructWithEmbeddedView) A() StructWithPtrsView
func (StructWithEmbeddedView) AsStruct ¶
func (v StructWithEmbeddedView) AsStruct() *StructWithEmbedded
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (StructWithEmbeddedView) MarshalJSON ¶
func (v StructWithEmbeddedView) MarshalJSON() ([]byte, error)
func (StructWithEmbeddedView) StructWithSlices ¶
func (v StructWithEmbeddedView) StructWithSlices() StructWithSlicesView
func (*StructWithEmbeddedView) UnmarshalJSON ¶
func (v *StructWithEmbeddedView) UnmarshalJSON(b []byte) error
func (StructWithEmbeddedView) Valid ¶
func (v StructWithEmbeddedView) Valid() bool
Valid reports whether v's underlying value is non-nil.
type StructWithNoView ¶
type StructWithNoView struct { Value int }
type StructWithPtrs ¶
type StructWithPtrs struct { Value *StructWithoutPtrs Int *int NoView *StructWithNoView NoCloneValue *StructWithoutPtrs `codegen:"noclone"` }
func (*StructWithPtrs) Clone ¶
func (src *StructWithPtrs) Clone() *StructWithPtrs
Clone makes a deep copy of StructWithPtrs. The result aliases no memory with the original.
func (*StructWithPtrs) Equal ¶
func (v *StructWithPtrs) Equal(v2 *StructWithPtrs) bool
func (*StructWithPtrs) String ¶
func (v *StructWithPtrs) String() string
func (*StructWithPtrs) View ¶
func (p *StructWithPtrs) View() StructWithPtrsView
View returns a read-only view of StructWithPtrs.
type StructWithPtrsAlias ¶
type StructWithPtrsAlias = StructWithPtrs
type StructWithPtrsAliasView ¶
type StructWithPtrsAliasView = StructWithPtrsView
type StructWithPtrsView ¶
type StructWithPtrsView struct {
// contains filtered or unexported fields
}
StructWithPtrsView provides a read-only view over StructWithPtrs.
Its methods should only be called if `Valid()` returns true.
func (StructWithPtrsView) AsStruct ¶
func (v StructWithPtrsView) AsStruct() *StructWithPtrs
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (StructWithPtrsView) Equal ¶
func (v StructWithPtrsView) Equal(v2 StructWithPtrsView) bool
func (StructWithPtrsView) Int ¶
func (v StructWithPtrsView) Int() views.ValuePointer[int]
func (StructWithPtrsView) MarshalJSON ¶
func (v StructWithPtrsView) MarshalJSON() ([]byte, error)
func (StructWithPtrsView) NoCloneValue ¶
func (v StructWithPtrsView) NoCloneValue() *StructWithoutPtrs
func (StructWithPtrsView) NoView ¶
func (v StructWithPtrsView) NoView() views.ValuePointer[StructWithNoView]
func (StructWithPtrsView) String ¶
func (v StructWithPtrsView) String() string
func (*StructWithPtrsView) UnmarshalJSON ¶
func (v *StructWithPtrsView) UnmarshalJSON(b []byte) error
func (StructWithPtrsView) Valid ¶
func (v StructWithPtrsView) Valid() bool
Valid reports whether v's underlying value is non-nil.
func (StructWithPtrsView) Value ¶
func (v StructWithPtrsView) Value() StructWithoutPtrsView
type StructWithSlices ¶
type StructWithSlices struct { Values []StructWithoutPtrs ValuePointers []*StructWithoutPtrs StructPointers []*StructWithPtrs Slice []string Prefixes []netip.Prefix Data []byte // Unsupported views. Structs []StructWithPtrs Ints []*int }
func (*StructWithSlices) Clone ¶
func (src *StructWithSlices) Clone() *StructWithSlices
Clone makes a deep copy of StructWithSlices. The result aliases no memory with the original.
func (*StructWithSlices) View ¶
func (p *StructWithSlices) View() StructWithSlicesView
View returns a read-only view of StructWithSlices.
type StructWithSlicesView ¶
type StructWithSlicesView struct {
// contains filtered or unexported fields
}
StructWithSlicesView provides a read-only view over StructWithSlices.
Its methods should only be called if `Valid()` returns true.
func (StructWithSlicesView) AsStruct ¶
func (v StructWithSlicesView) AsStruct() *StructWithSlices
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (StructWithSlicesView) Data ¶
func (v StructWithSlicesView) Data() views.ByteSlice[[]byte]
func (StructWithSlicesView) Ints ¶
func (v StructWithSlicesView) Ints() *int
func (StructWithSlicesView) MarshalJSON ¶
func (v StructWithSlicesView) MarshalJSON() ([]byte, error)
func (StructWithSlicesView) Prefixes ¶
func (v StructWithSlicesView) Prefixes() views.Slice[netip.Prefix]
func (StructWithSlicesView) Slice ¶
func (v StructWithSlicesView) Slice() views.Slice[string]
func (StructWithSlicesView) StructPointers ¶
func (v StructWithSlicesView) StructPointers() views.SliceView[*StructWithPtrs, StructWithPtrsView]
func (StructWithSlicesView) Structs ¶
func (v StructWithSlicesView) Structs() StructWithPtrs
func (*StructWithSlicesView) UnmarshalJSON ¶
func (v *StructWithSlicesView) UnmarshalJSON(b []byte) error
func (StructWithSlicesView) Valid ¶
func (v StructWithSlicesView) Valid() bool
Valid reports whether v's underlying value is non-nil.
func (StructWithSlicesView) ValuePointers ¶
func (v StructWithSlicesView) ValuePointers() views.SliceView[*StructWithoutPtrs, StructWithoutPtrsView]
func (StructWithSlicesView) Values ¶
func (v StructWithSlicesView) Values() views.Slice[StructWithoutPtrs]
type StructWithTypeAliasFields ¶
type StructWithTypeAliasFields struct { WithPtr StructWithPtrsAlias WithoutPtr StructWithoutPtrsAlias WithPtrByPtr *StructWithPtrsAlias WithoutPtrByPtr *StructWithoutPtrsAlias SliceWithPtrs []*StructWithPtrsAlias SliceWithoutPtrs []*StructWithoutPtrsAlias MapWithPtrs map[string]*StructWithPtrsAlias MapWithoutPtrs map[string]*StructWithoutPtrsAlias MapOfSlicesWithPtrs map[string][]*StructWithPtrsAlias MapOfSlicesWithoutPtrs map[string][]*StructWithoutPtrsAlias }
func (*StructWithTypeAliasFields) Clone ¶
func (src *StructWithTypeAliasFields) Clone() *StructWithTypeAliasFields
Clone makes a deep copy of StructWithTypeAliasFields. The result aliases no memory with the original.
func (*StructWithTypeAliasFields) View ¶
func (p *StructWithTypeAliasFields) View() StructWithTypeAliasFieldsView
View returns a read-only view of StructWithTypeAliasFields.
type StructWithTypeAliasFieldsView ¶
type StructWithTypeAliasFieldsView struct {
// contains filtered or unexported fields
}
StructWithTypeAliasFieldsView provides a read-only view over StructWithTypeAliasFields.
Its methods should only be called if `Valid()` returns true.
func (StructWithTypeAliasFieldsView) AsStruct ¶
func (v StructWithTypeAliasFieldsView) AsStruct() *StructWithTypeAliasFields
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (StructWithTypeAliasFieldsView) MapOfSlicesWithPtrs ¶
func (v StructWithTypeAliasFieldsView) MapOfSlicesWithPtrs() views.MapFn[string, []*StructWithPtrsAlias, views.SliceView[*StructWithPtrsAlias, StructWithPtrsAliasView]]
func (StructWithTypeAliasFieldsView) MapOfSlicesWithoutPtrs ¶
func (v StructWithTypeAliasFieldsView) MapOfSlicesWithoutPtrs() views.MapFn[string, []*StructWithoutPtrsAlias, views.SliceView[*StructWithoutPtrsAlias, StructWithoutPtrsAliasView]]
func (StructWithTypeAliasFieldsView) MapWithPtrs ¶
func (v StructWithTypeAliasFieldsView) MapWithPtrs() views.MapFn[string, *StructWithPtrsAlias, StructWithPtrsAliasView]
func (StructWithTypeAliasFieldsView) MapWithoutPtrs ¶
func (v StructWithTypeAliasFieldsView) MapWithoutPtrs() views.MapFn[string, *StructWithoutPtrsAlias, StructWithoutPtrsAliasView]
func (StructWithTypeAliasFieldsView) MarshalJSON ¶
func (v StructWithTypeAliasFieldsView) MarshalJSON() ([]byte, error)
func (StructWithTypeAliasFieldsView) SliceWithPtrs ¶
func (v StructWithTypeAliasFieldsView) SliceWithPtrs() views.SliceView[*StructWithPtrsAlias, StructWithPtrsAliasView]
func (StructWithTypeAliasFieldsView) SliceWithoutPtrs ¶
func (v StructWithTypeAliasFieldsView) SliceWithoutPtrs() views.SliceView[*StructWithoutPtrsAlias, StructWithoutPtrsAliasView]
func (*StructWithTypeAliasFieldsView) UnmarshalJSON ¶
func (v *StructWithTypeAliasFieldsView) UnmarshalJSON(b []byte) error
func (StructWithTypeAliasFieldsView) Valid ¶
func (v StructWithTypeAliasFieldsView) Valid() bool
Valid reports whether v's underlying value is non-nil.
func (StructWithTypeAliasFieldsView) WithPtr ¶
func (v StructWithTypeAliasFieldsView) WithPtr() StructWithPtrsAliasView
func (StructWithTypeAliasFieldsView) WithPtrByPtr ¶
func (v StructWithTypeAliasFieldsView) WithPtrByPtr() StructWithPtrsAliasView
func (StructWithTypeAliasFieldsView) WithoutPtr ¶
func (v StructWithTypeAliasFieldsView) WithoutPtr() StructWithoutPtrsAlias
func (StructWithTypeAliasFieldsView) WithoutPtrByPtr ¶
func (v StructWithTypeAliasFieldsView) WithoutPtrByPtr() StructWithoutPtrsAliasView
type StructWithoutPtrs ¶
func (*StructWithoutPtrs) Clone ¶
func (src *StructWithoutPtrs) Clone() *StructWithoutPtrs
Clone makes a deep copy of StructWithoutPtrs. The result aliases no memory with the original.
func (*StructWithoutPtrs) View ¶
func (p *StructWithoutPtrs) View() StructWithoutPtrsView
View returns a read-only view of StructWithoutPtrs.
type StructWithoutPtrsAlias ¶
type StructWithoutPtrsAlias = StructWithoutPtrs
type StructWithoutPtrsAliasView ¶
type StructWithoutPtrsAliasView = StructWithoutPtrsView
type StructWithoutPtrsView ¶
type StructWithoutPtrsView struct {
// contains filtered or unexported fields
}
StructWithoutPtrsView provides a read-only view over StructWithoutPtrs.
Its methods should only be called if `Valid()` returns true.
func (StructWithoutPtrsView) AsStruct ¶
func (v StructWithoutPtrsView) AsStruct() *StructWithoutPtrs
AsStruct returns a clone of the underlying value which aliases no memory with the original.
func (StructWithoutPtrsView) Int ¶
func (v StructWithoutPtrsView) Int() int
func (StructWithoutPtrsView) MarshalJSON ¶
func (v StructWithoutPtrsView) MarshalJSON() ([]byte, error)
func (StructWithoutPtrsView) Pfx ¶
func (v StructWithoutPtrsView) Pfx() netip.Prefix
func (*StructWithoutPtrsView) UnmarshalJSON ¶
func (v *StructWithoutPtrsView) UnmarshalJSON(b []byte) error
func (StructWithoutPtrsView) Valid ¶
func (v StructWithoutPtrsView) Valid() bool
Valid reports whether v's underlying value is non-nil.
Source Files ¶
tests.go tests_clone.go tests_view.go
- Version
- v1.82.5 (latest)
- Published
- Apr 17, 2025
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 9 hours ago –
Tools for package owners.