improved documentation

master
Charles Iliya Krempeaux 2022-07-18 22:02:10 -07:00
parent e35e1b4a18
commit 50d87b31bb
1 changed files with 18 additions and 1 deletions

View File

@ -5,6 +5,24 @@ import (
) )
// WriteRune writes a single UTF-8 encoded Unicode character and returns the number of bytes written. // 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.
//
// Example
//
// Here is an example usage of WriteRune:
//
// n, err := utf8.WriteRune(writer, r)
// if nil != err {
//
// switch err.(type) {
// case utf8.NilWriterComplainer:
// //@TODO
// default:
// //TODO
// }
//
// }
func WriteRune(writer io.Writer, r rune) (int, error) { func WriteRune(writer io.Writer, r rune) (int, error) {
if nil == writer { if nil == writer {
return 0, errNilWriter return 0, errNilWriter
@ -56,5 +74,4 @@ func WriteRune(writer io.Writer, r rune) (int, error) {
default: default:
return 0, errInternalError return 0, errInternalError
} }
} }