Trait WritableServerHandler

Source
pub trait WritableServerHandler<___T: Transport> {
    // Required method
    fn write(
        &mut self,
        sender: &ServerSender<___T, Writable>,
        request: RequestBuffer<___T, Write>,
        responder: Responder<Write>,
    );
}
Expand description

A server handler for the Writable protocol.

See Writable for more details.

Required Methods§

Source

fn write( &mut self, sender: &ServerSender<___T, Writable>, request: RequestBuffer<___T, Write>, responder: Responder<Write>, )

Writes data at the seek offset. The seek offset is moved forward by the number of bytes written. If the file is in append mode, the seek offset is first set to the end of the file, followed by the write, in one atomic step.

The file size may grow if the seek offset plus data.length is beyond the current end of file.

  • request data the byte buffer to write to the file.
  • response actual_count the number of bytes written.
§Invariants
  • The returned actual_count will never be greater than data.length.
  • If the server is unable to write all the data due to e.g. not enough space, actual_count may be less than data.length. If no bytes could be written, an error is returned.
  • If data.length is zero, the server should perform all the checks ensuring write access without mutating the file and return a successful write of zero bytes. The seek offset is still updated if in append mode.

This method requires the [Rights.WRITE_BYTES] right.

Implementors§