Trait tk_sendfile::Destination
[−]
[src]
pub trait Destination: Write + Send { fn write_file<O: FileOpener>(&mut self,
file: &mut Sendfile<O>)
-> Result<usize, Error>; fn poll_write(&mut 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>
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(&mut self) -> Async<()>
Test to see if this object may be writable
Implementors
impl Destination for TcpStream