Added `pair()`: Create 2 interlinked pipes for bi-directional communication.
Fixed transfering ownership of raw socket fds not surpressing destructor of previous owner type.
Fortune for comfork's current commit: Curse − 凶
// Make sure when operating on consumers of Pipe of Read/WriteHalf, the pipe structures are `mem::forget`ed before returning, since the Drop impl of those types closes the raw socket.
implPipe
{
/// Split this pipe into a read and write half.
@ -61,7 +63,9 @@ impl Pipe
/// Data written to the `WriteHalf` is sent to the `ReadHalf` (unless the pipe is mismatched.)
#[inline]pubfnsplit(self)-> (WriteHalf,ReadHalf)
{
(WriteHalf(self.tx),ReadHalf(self.rx))
letrv=(WriteHalf(self.tx),ReadHalf(self.rx));
std::mem::forget(self);
rv
}
/// Create a `Pipe` from two halves.
@ -71,7 +75,9 @@ impl Pipe
/// If they are not, then writing to the `Pipe` will send the data to its original receiver, and reading from it will take the data from its original sender.