olfactor

package
v3.88.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Olfactor

type Olfactor struct {
	// contains filtered or unexported fields
}

Olfactor may be used for 'sniffing' an io stream for strings. In other words, the io stream can be monitored for a particular strings, and if they string are written to the io stream, the olfactor will record that it has 'smelt' that string.

func New

func New(dst io.Writer, smells []string) (io.Writer, *Olfactor)

New returns an io.Writer and an Olfactor. Writes to the writer will be forwarded to `dst` and the returned Olfactor will record whether the elements of `smells` have been written to the io.Writer.

If a smell is the empty string, we consider it to have been smelt, even if nothing was wrtten to the io.Writer. This is consistent with the notion that writing an empty string to a writer is the same as writing nothing to the writer.

func (*Olfactor) AllSmelt added in v3.54.0

func (d *Olfactor) AllSmelt() []string

AllSmelt returns all the smells that the Olfactor has smelt.

func (*Olfactor) Smelt

func (d *Olfactor) Smelt(smell string) bool

Smelt returns true if and only if the Olfactor smelt the smell.

Jump to

Keyboard shortcuts

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