Documentation
¶
Index ¶
- func FromBytes[T comparable](b []byte) *T
- func FromPointer[T comparable](p unsafe.Pointer) *T
- func SliceFromBytes[T comparable](b []byte, n int) []T
- func SliceFromPointer[T comparable](p unsafe.Pointer, n int) []T
- type Union
- func NewFromBytes[T comparable](b []byte) Union[*T]
- func NewFromReader[T comparable](r io.Reader) (Union[*T], error)
- func NewFromSlice[T comparable](v []T) Union[[]T]
- func NewFromValue[T comparable](v *T) Union[*T]
- func NewSliceFromBytes[T comparable](b []byte, n int) Union[[]T]
- func NewSliceFromReader[T comparable](r io.Reader, n int) (Union[[]T], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromBytes ¶ added in v0.5.0
func FromBytes[T comparable](b []byte) *T
FromBytes converts byte slice to *T.
func FromPointer ¶ added in v0.6.0
func FromPointer[T comparable](p unsafe.Pointer) *T
FromPointer converts pointer to byte slice to *T.
func SliceFromBytes ¶ added in v0.5.0
func SliceFromBytes[T comparable](b []byte, n int) []T
SliceFromBytes converts byte slice to slice of type T.
func SliceFromPointer ¶ added in v0.6.0
func SliceFromPointer[T comparable](p unsafe.Pointer, n int) []T
SliceFromPointer converts pointer to byte slice to slice of type T.
Types ¶
type Union ¶
Union represents a C-like union between bytes and structure.
func NewFromBytes ¶
func NewFromBytes[T comparable](b []byte) Union[*T]
NewFromBytes creates union from bytes.
func NewFromReader ¶
func NewFromReader[T comparable](r io.Reader) (Union[*T], error)
NewFromReader creates union from bytes read from the reader.
func NewFromSlice ¶ added in v0.4.0
func NewFromSlice[T comparable](v []T) Union[[]T]
NewFromSlice creates union from slice.
func NewFromValue ¶
func NewFromValue[T comparable](v *T) Union[*T]
NewFromValue creates union from value.
func NewSliceFromBytes ¶ added in v0.4.0
func NewSliceFromBytes[T comparable](b []byte, n int) Union[[]T]
NewSliceFromBytes creates union containing slice from bytes.
func NewSliceFromReader ¶ added in v0.4.0
NewSliceFromReader creates union containing slice from bytes read from the reader.