closerset

package module
v0.0.0-...-0bd6755 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 3 Imported by: 0

README

CloserSet

CloserSet is a set of io.Closer. It modifies and records io.Closer.

When CloserSet.Close() is called, it closes all underlying closers which have not been closed.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloserSet

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

CloserSet records a set of closers. All closers will be closed when the CloserSet closes. When a wrapped closer is closed, the record in the CloserSet will be removed. i.e., the closer will only be closed once.

func (*CloserSet) Close

func (c *CloserSet) Close() error

Close underlying closers.

func (*CloserSet) WrapAndRecord

func (c *CloserSet) WrapAndRecord(closer io.Closer) io.Closer

WrapAndRecord wrap a closer and return wrapped closer. NOTE: the input closer should not be invoked after wrap.

Jump to

Keyboard shortcuts

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