From c2b6e0a0b037696620b0008dddb5406db151f52c Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Mon, 18 Jul 2022 22:12:14 -0700 Subject: [PATCH] improved documentation --- readrune.go | 22 ++++++++++++++++++++++ writerune.go | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/readrune.go b/readrune.go index b84462d..5b52e64 100644 --- a/readrune.go +++ b/readrune.go @@ -7,6 +7,28 @@ import ( // ReadRune reads a single UTF-8 encoded Unicode character from an io.Reader, // and returns the Unicode character (as a Go rune) and the number of bytes read. // +// If ‘reader’ is nil then ReaderRune will return an error that matches utf8.NilReaderComplainer. +// +// Example +// +// Here is an example usage of ReadRune: +// +// r, n, err := utf8.ReadRune(reader) +// if nil != err { +// +// switch err.(type) { +// case utf8.NilReaderComplainer: +// //@TODO +// case utf8.InvalidUTF8Complainer: +// //@TODO +// default: +// //TODO +// } +// +// } +// +// Number Of Bytes +// // Note that a single UTF-8 encoded Unicode character could be more than one byte. // // For example, the Unicode "≡" (IDENTICAL TO) character gets encoded using 3 bytes under UTF-8. diff --git a/writerune.go b/writerune.go index e27da0f..df1b4b4 100644 --- a/writerune.go +++ b/writerune.go @@ -6,7 +6,7 @@ import ( // WriteRune writes a single UTF-8 encoded Unicode character and returns the number of bytes written. // -// If ‘writer’ is nil then WriteRune will return an error that matches utf8.WriteRune. +// If ‘writer’ is nil then WriteRune will return an error that matches utf8.NilWriterComplainer. // // Example //