Add documentation for a few more types

This commit is contained in:
Christian Muehlhaeuser
2019-12-25 05:40:28 +01:00
parent 9157a40ab2
commit 56af24c72d
6 changed files with 23 additions and 6 deletions
+3
View File
@@ -5,12 +5,14 @@ import (
"io"
)
// StyleWriter is a Writer that applies styling on whatever you write to it.
type StyleWriter struct {
w io.Writer
buf bytes.Buffer
rules StylePrimitive
}
// NewStyleWriter returns a new StyleWriter.
func NewStyleWriter(ctx RenderContext, w io.Writer, rules StylePrimitive) *StyleWriter {
return &StyleWriter{
w: w,
@@ -22,6 +24,7 @@ func (w *StyleWriter) Write(b []byte) (int, error) {
return w.buf.Write(b)
}
// Close must be called when you're finished writing to a StyleWriter.
func (w *StyleWriter) Close() error {
renderText(w.w, w.rules, w.buf.String())
return nil