package transform

Import Path
	vendor/golang.org/x/text/transform (on go.dev)

Dependency Relation
	imports 4 packages, and imported by 2 packages

Involved Source Files Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations. Example transformations provided by other packages include normalization and conversion between character sets.
Package-Level Type Names (total 10, in which 5 are exported)
/* sort exporteds by: | */
NopResetter can be embedded by implementations of Transformer to add a nop Reset method. Reset implements the Reset method of the Transformer interface.
Reader wraps another io.Reader by transforming the bytes read. Read implements the io.Reader interface. *Reader : io.Reader func NewReader(r io.Reader, t Transformer) *Reader
SpanningTransformer extends the Transformer interface with a Span method that determines how much of the input already conforms to the Transformer. Reset resets the state and allows a Transformer to be reused. Span returns a position in src such that transforming src[:n] results in identical output src[:n] for these bytes. It does not necessarily return the largest such n. The atEOF argument tells whether src represents the last bytes of the input. Callers should always account for the n bytes consumed before considering the error err. A nil error means that all input bytes are known to be identical to the output produced by the Transformer. A nil error can be returned regardless of whether atEOF is true. If err is nil, then n must equal len(src); the converse is not necessarily true. ErrEndOfSpan means that the Transformer output may differ from the input after n bytes. Note that n may be len(src), meaning that the output would contain additional bytes after otherwise identical output. ErrShortSrc means that src had insufficient data to determine whether the remaining bytes would change. Other than the error conditions listed here, implementations are free to report other errors that arise. Calling Span can modify the Transformer state as a side effect. In effect, it does the transformation just as calling Transform would, only without copying to a destination buffer and only up to a point it can determine the input and output bytes are the same. This is obviously more limited than calling Transform, but can be more efficient in terms of copying and allocating buffers. Calls to Span and Transform may be interleaved. Transform writes to dst the transformed bytes read from src, and returns the number of dst bytes written and src bytes read. The atEOF argument tells whether src represents the last bytes of the input. Callers should always process the nDst bytes produced and account for the nSrc bytes consumed before considering the error err. A nil error means that all of the transformed bytes (whether freshly transformed from src or left over from previous Transform calls) were written to dst. A nil error can be returned regardless of whether atEOF is true. If err is nil then nSrc must equal len(src); the converse is not necessarily true. ErrShortDst means that dst was too short to receive all of the transformed bytes. ErrShortSrc means that src had insufficient data to complete the transformation. If both conditions apply, then either error may be returned. Other than the error conditions listed here, implementations are free to report other errors that arise. *vendor/golang.org/x/text/secure/bidirule.Transformer vendor/golang.org/x/text/unicode/norm.Form SpanningTransformer : Transformer var Nop
Transformer transforms bytes. Reset resets the state and allows a Transformer to be reused. Transform writes to dst the transformed bytes read from src, and returns the number of dst bytes written and src bytes read. The atEOF argument tells whether src represents the last bytes of the input. Callers should always process the nDst bytes produced and account for the nSrc bytes consumed before considering the error err. A nil error means that all of the transformed bytes (whether freshly transformed from src or left over from previous Transform calls) were written to dst. A nil error can be returned regardless of whether atEOF is true. If err is nil then nSrc must equal len(src); the converse is not necessarily true. ErrShortDst means that dst was too short to receive all of the transformed bytes. ErrShortSrc means that src had insufficient data to complete the transformation. If both conditions apply, then either error may be returned. Other than the error conditions listed here, implementations are free to report other errors that arise. SpanningTransformer (interface) *vendor/golang.org/x/text/secure/bidirule.Transformer vendor/golang.org/x/text/unicode/norm.Form func Chain(t ...Transformer) Transformer func RemoveFunc(f func(r rune) bool) Transformer func Append(t Transformer, dst, src []byte) (result []byte, n int, err error) func Bytes(t Transformer, b []byte) (result []byte, n int, err error) func Chain(t ...Transformer) Transformer func NewReader(r io.Reader, t Transformer) *Reader func NewWriter(w io.Writer, t Transformer) *Writer func String(t Transformer, s string) (result string, n int, err error) var Discard
Writer wraps another io.Writer by transforming the bytes read. The user needs to call Close to flush unwritten bytes that may be buffered. Close implements the io.Closer interface. Write implements the io.Writer interface. If there are not enough bytes available to complete a Transform, the bytes will be buffered for the next write. Call Close to convert the remaining bytes. *Writer : internal/bisect.Writer *Writer : io.Closer *Writer : io.WriteCloser *Writer : io.Writer func NewWriter(w io.Writer, t Transformer) *Writer
Package-Level Functions (total 9, in which 7 are exported)
Append appends the result of converting src[:n] using t to dst, where n <= len(src), If err == nil, n will be len(src). It calls Reset on t.
Bytes returns a new byte slice with the result of converting b[:n] using t, where n <= len(b). If err == nil, n will be len(b). It calls Reset on t.
Chain returns a Transformer that applies t in sequence.
NewReader returns a new Reader that wraps r by transforming the bytes read via t. It calls Reset on t.
NewWriter returns a new Writer that wraps w by transforming the bytes written via t. It calls Reset on t.
Deprecated: Use runes.Remove instead.
String returns a string with the result of converting s[:n] using t, where n <= len(s). If err == nil, n will be len(s). It calls Reset on t.
Package-Level Variables (total 7, in which 5 are exported)
Discard is a Transformer for which all Transform calls succeed by consuming all bytes and writing nothing.
ErrEndOfSpan means that the input and output (the transformed input) are not identical.
ErrShortDst means that the destination buffer was too short to receive all of the transformed bytes.
ErrShortSrc means that the source buffer has insufficient data to complete the transformation.
Nop is a SpanningTransformer that copies src to dst.
Package-Level Constants (total 2, neither is exported)