Skip to main content

Close

Trait Close 

Source
pub trait Close: Write {
    // Required method
    fn close(self) -> Result<()>;
}
Expand description

An extension trait for safely dropping I/O writers.

Required Methods§

Source

fn close(self) -> Result<()>

Drops an I/O writer and closes any resource handle contained inside (such as a raw file descriptor). Ensures that I/O errors resulting from closing a handle are not ignored. The writer is flushed before any handle is closed. If any errors occur during flushing or closing the first such error is returned.

Implementations on Foreign Types§

Source§

impl Close for &mut [u8]

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer for which close() never produces an error, and for which flushing is unnecessary.

Source§

impl Close for Vec<u8>

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer for which close() never produces an error, and for which flushing is unnecessary.

Source§

impl Close for Cursor<&mut Vec<u8>>

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer for which close() never produces an error, and for which flushing is unnecessary.

Source§

impl Close for Cursor<&mut [u8]>

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer for which close() never produces an error, and for which flushing is unnecessary.

Source§

impl Close for Cursor<Box<[u8]>>

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer for which close() never produces an error, and for which flushing is unnecessary.

Source§

impl Close for Cursor<Vec<u8>>

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer for which close() never produces an error, and for which flushing is unnecessary.

Source§

impl Close for Sink

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer for which close() never produces an error, and for which flushing is unnecessary.

Source§

impl Close for File

Available on Unix and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer containing a raw file descriptor.

Source§

impl Close for TcpStream

Available on Unix and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer containing a raw file descriptor.

Source§

impl Close for UnixStream

Available on Unix and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer containing a raw file descriptor.

Source§

impl Close for ChildStdin

Available on Unix and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer containing a raw file descriptor.

Source§

impl Close for PipeWriter

Available on crate feature os_pipe only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer containing a raw file descriptor.

Source§

impl<W: Close> Close for BufWriter<W>

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer which can be unwrapped using into_inner() to return an underlying writer.

Source§

impl<W: Close> Close for LineWriter<W>

Available on (Unix or Windows) and (crate feature unix or target_family=unix) only.
Source§

fn close(self) -> Result<()>

Drops an I/O writer which can be unwrapped using into_inner() to return an underlying writer.

Implementors§