github.com/mutagen-io/mutagen@v0.18.0-rc1/pkg/stream/flush_closer.go (about) 1 package stream 2 3 import ( 4 "io" 5 ) 6 7 // flushCloser is the io.Closer implementation underlying NewFlushCloser. 8 type flushCloser struct { 9 // flusher is the underlying flusher. 10 flusher Flusher 11 } 12 13 // NewFlushCloser creates a new io.Closer that aliases Close to the specified 14 // flusher's Flush method. It is primarily used for bufio.Writer instances. 15 func NewFlushCloser(flusher Flusher) io.Closer { 16 return &flushCloser{flusher} 17 } 18 19 // Close implements io.Closer.Close. 20 func (c *flushCloser) Close() error { 21 return c.flusher.Flush() 22 }