Golang fmt.ScanState type examples

package fmt

ScanState represents the scanner state passed to custom scanners. Scanners may do rune-at-a-time scanning or ask the ScanState to discover the next space-delimited token.

Golang fmt.ScanState type usage examples

Example 1:

 func (z *Int) Scan(s fmt.ScanState, ch rune) error {
 s.SkipSpace() // skip leading space characters
 ...
 }

Example 2:

 func (z *Rat) Scan(s fmt.ScanState, ch rune) error {
 tok, err := s.Token(true, ratTok) 
 if err != nil {
 return err
 }
 ...

Reference :

http://golang.org/pkg/fmt/#ScanState

Advertisement