encoding

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Encodings = make([]func() EncodingFunc, maxEncoding)
)

Functions

func RegisterEncoding

func RegisterEncoding(e Encoding, f func() EncodingFunc) error

RegisterEncoding registers a function that returns a new instance of the given Encoding function. This is intended to be called from the init function in packages that implement Encoding functions.

Types

type Encoding

type Encoding uint
const (
	None Encoding = iota
	Base64
	Hex
)

func (Encoding) Available

func (e Encoding) Available() bool

Available reports whether the given Encoding function is linked into the binary.

func (Encoding) EncodingFunc

func (e Encoding) EncodingFunc() Encoding

func (Encoding) New

func (e Encoding) New() EncodingFunc

New returns a new Encoding.Encoding calculating the given Encoding function. New returns nil if the Encoding function is not linked into the binary.

func (Encoding) String

func (e Encoding) String() string

type EncodingFunc

type EncodingFunc interface {
	EncodeToString(src []byte) string
}

Jump to

Keyboard shortcuts

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