...

Source file src/golang.org/x/text/secure/precis/transformer.go

Documentation: golang.org/x/text/secure/precis

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package precis
     6  
     7  import "golang.org/x/text/transform"
     8  
     9  // Transformer implements the transform.Transformer interface.
    10  type Transformer struct {
    11  	t transform.Transformer
    12  }
    13  
    14  // Reset implements the transform.Transformer interface.
    15  func (t Transformer) Reset() { t.t.Reset() }
    16  
    17  // Transform implements the transform.Transformer interface.
    18  func (t Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {
    19  	return t.t.Transform(dst, src, atEOF)
    20  }
    21  
    22  // Bytes returns a new byte slice with the result of applying t to b.
    23  func (t Transformer) Bytes(b []byte) []byte {
    24  	b, _, _ = transform.Bytes(t, b)
    25  	return b
    26  }
    27  
    28  // String returns a string with the result of applying t to s.
    29  func (t Transformer) String(s string) string {
    30  	s, _, _ = transform.String(t, s)
    31  	return s
    32  }
    33  

View as plain text