Source File
internal.go
Belonging Package
golang.org/x/text/encoding/internal
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package internal contains code that is shared among encoding implementations.
package internal
import (
)
// Encoding is an implementation of the Encoding interface that adds the String
// and ID methods to an existing encoding.
type Encoding struct {
encoding.Encoding
Name string
MIB identifier.MIB
}
// _ verifies that Encoding implements identifier.Interface.
var _ identifier.Interface = (*Encoding)(nil)
func ( *Encoding) () string {
return .Name
}
func ( *Encoding) () ( identifier.MIB, string) {
return .MIB, ""
}
// SimpleEncoding is an Encoding that combines two Transformers.
type SimpleEncoding struct {
Decoder transform.Transformer
Encoder transform.Transformer
}
func ( *SimpleEncoding) () *encoding.Decoder {
return &encoding.Decoder{Transformer: .Decoder}
}
func ( *SimpleEncoding) () *encoding.Encoder {
return &encoding.Encoder{Transformer: .Encoder}
}
// FuncEncoding is an Encoding that combines two functions returning a new
// Transformer.
type FuncEncoding struct {
Decoder func() transform.Transformer
Encoder func() transform.Transformer
}
func ( FuncEncoding) () *encoding.Decoder {
return &encoding.Decoder{Transformer: .Decoder()}
}
func ( FuncEncoding) () *encoding.Encoder {
return &encoding.Encoder{Transformer: .Encoder()}
}
// A RepertoireError indicates a rune is not in the repertoire of a destination
// encoding. It is associated with an encoding-specific suggested replacement
// byte.
type RepertoireError byte
// Error implements the error interface.
func ( RepertoireError) () string {
return "encoding: rune not supported by encoding."
}
// Replacement returns the replacement string associated with this error.
func ( RepertoireError) () byte { return byte() }
var ErrASCIIReplacement = RepertoireError(encoding.ASCIISub)
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |