gvisorgvisor.dev/gvisor/pkg/linewriter Index | Files

package linewriter

import "gvisor.dev/gvisor/pkg/linewriter"

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

Index

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.

Source Files

linewriter.go

Version
v0.0.0-20250731213340-6cadfa6c8fe1 (latest)
Published
Jul 31, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
10 hours ago

Tools for package owners.