bytecounter

command
v0.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Bytecounter shows how to use interfaces. It implements a (concrete) type named ByteCounter whose Write method counts bytes before discarding them. Since ByteCounter satisfies the io.Writer interface (an abstract type), we can pass it to fmt.Fprint.

Adapted from github.com/adonovan/gopl.io/blob/master/ch7/bytecounter.

Level: beginner Topics: interfaces, io.Writer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL