[][src]Trait smolapps::tftp::Handle

pub trait Handle {
    fn read(&mut self, buf: &mut [u8]) -> Result<usize, ()>;
fn write(&mut self, buf: &[u8]) -> Result<usize, ()>; }

An open file handle returned by a Context::open() operation.

Required methods

fn read(&mut self, buf: &mut [u8]) -> Result<usize, ()>

Pulls some bytes from this handle into the specified buffer, returning how many bytes were read.

buf is guaranteed to be exactly 512 bytes long, the maximum packet size allowed by the protocol.

fn write(&mut self, buf: &[u8]) -> Result<usize, ()>

Writes a buffer into this handle's buffer, returning how many bytes were written.

buf can be anywhere from 0 to 512 bytes long.

Loading content...

Implementors

Loading content...