linewriter

package
v0.0.0-...-989fa2c Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Overview

Package linewriter provides an io.Writer which calls an emitter on each line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer struct {
	// the mutex locks buf.
	sync.Mutex
	// contains filtered or unexported fields
}

Writer is an io.Writer which buffers input, flushing individual lines through an emitter function.

func NewWriter

func NewWriter(emitter func(p []byte)) *Writer

NewWriter creates a Writer which emits using emitter. The emitter must not retain p. It may change after emitter returns.

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Write implements io.Writer.Write. It calls emit on each line of input, not including the newline. Write may be called concurrently.

Jump to

Keyboard shortcuts

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