[][src]Function sendfile::send_file

Important traits for SendFile<F, S>
pub unsafe fn send_file<F, S>(file: F, socket: S) -> SendFile<F, S>

Send a file out a socket.

Arguments

  • file must be a regular file, i.e. File, opened for reading.
  • socket must be a socket, e.g. TcpStream or UdpSocket, opened for writing.

Unsafety

This function is unsafe because the caller must ensure that the provided file and socket are usable in the sendfile system call. The requirements for this system call are different between platforms.