prefixsuffix

package module
v0.0.0-...-5a0456b Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 2 Imported by: 1

README

prefixsuffix

GoDoc

Exported os/exec.prefixSuffixSaver.

// Saver is an io.Writer which retains the first N bytes
// and the last N bytes written to it. The Bytes() methods reconstructs
// it with a pretty error message.
type Saver struct {
    N         int // max size of prefix or suffix
    // ...
}

Basic Usage

func something() {
    s := &prefixsuffix.Saver{N: 4}
    io.WriteString(s, "1234 --- 5678")
    fmt.Printf("%s\n", s.Bytes())   
    // 1234
    // ... omitting 5 bytes ...
    // 5678
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Saver

type Saver struct {
	N int // max size of prefix or suffix
	// contains filtered or unexported fields
}

Saver is an io.Writer which retains the first N bytes and the last N bytes written to it. The Bytes() methods reconstructs it with a pretty error message.

func (*Saver) Bytes

func (w *Saver) Bytes() []byte

func (*Saver) Write

func (w *Saver) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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