package vals

import (
	
	

	
)

// Pipe wraps a pair of pointers to os.File that are the two ends of the same
// pipe.
type Pipe struct {
	ReadEnd, WriteEnd *os.File
}

var _ interface{} = Pipe{}

// NewPipe creates a new Pipe value.
func (,  *os.File) Pipe {
	return Pipe{, }
}

// Kind returns "pipe".
func (Pipe) () string {
	return "pipe"
}

// Equal compares based on the equality of the two consistuent files.
func ( Pipe) ( interface{}) bool {
	,  := .(Pipe)
	if ! {
		return false
	}
	return Equal(.ReadEnd, .ReadEnd) && Equal(.WriteEnd, .WriteEnd)
}

// Hash calculates the hash based on the two consituent files.
func ( Pipe) () uint32 {
	return hash.DJB(Hash(.ReadEnd), Hash(.WriteEnd))
}

// Repr writes an opaque representation containing the FDs of the two
// constituent files.
func ( Pipe) (int) string {
	return fmt.Sprintf("<pipe{%v %v}>", .ReadEnd.Fd(), .WriteEnd.Fd())
}