An extension trait ([Close]) for safely closing I/O related types
such as File and
BufWriter. Specifically, it is for types
containing a resource handle which, when closed, may return an I/O
error.
Provided implementations are for standard library types which implement (or contain types which implement):
-
IntoRawFd(Unix) -
IntoRawHandleorIntoRawSocket(Windows).
Using [Close] enables the handling or reporting of I/O errors
which might otherwise be ignored during drop.
BufWriter example
use ;
use Close;