encoding

package
v0.0.0-...-ffb399c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package encoding is for utilities relating to the encoding package from the stdlib

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryUnmarshalCallback

func BinaryUnmarshalCallback[T encoding.BinaryUnmarshaler](newFn func() T, callback func(T, error)) func(buf []byte)

BinaryUnmarshalCallback returns a function that will decode the argument byte slice into T using `newFn` to create an instance of T and the encoding.BinaryUnmarshaler interface to do the actual conversion. `callback` will be called with the resulting T. If the argument byte slice is empty, callback will be called with `nil`. Unmarshalling errors will be provided to the callback as the second argument. The data argument to the callback may still be non-nil even if there was an error. This allows the callback to handle the allocated object, even in the face of errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL