Trait tk_sendfile::Destination
[−]
[src]
pub trait Destination: AsyncWrite + Send { fn write_file<O: FileOpener>(
&mut self,
file: &mut Sendfile<O>
) -> Result<usize, Error>; fn poll_write(&self) -> Async<()>; }
A trait that represents anything that file can be sent to
The trait is implemented for TcpStream right away but you might want to implement your own thing, for example to prepend the data with file length header
Required Methods
fn write_file<O: FileOpener>(
&mut self,
file: &mut Sendfile<O>
) -> Result<usize, Error>
&mut self,
file: &mut Sendfile<O>
) -> Result<usize, Error>
This method does the actual sendfile call
Note: this method is called in other thread
fn poll_write(&self) -> Async<()>
Test whether this socket is ready to be written to or not.
If socket isn't writable current taks must be scheduled to get a notification when socket does become writable.
Implementors
impl Destination for TcpStream