Codebase list golang-github-anacrolix-missinggo / debian/2.1.0-6 encoding.go
debian/2.1.0-6

Tree @debian/2.1.0-6 (Download .tar.gz)

encoding.go @debian/2.1.0-6raw · history · blame

package missinggo

// An interface for "encoding/base64".Encoder
type Encoding interface {
	EncodeToString([]byte) string
	DecodeString(string) ([]byte, error)
}

// An encoding that does nothing.
type IdentityEncoding struct{}

var _ Encoding = IdentityEncoding{}

func (IdentityEncoding) EncodeToString(b []byte) string        { return string(b) }
func (IdentityEncoding) DecodeString(s string) ([]byte, error) { return []byte(s), nil }