Trait Buffer

Source
pub trait Buffer {
    // Required methods
    fn as_ngx_buf(&self) -> *const ngx_buf_t;
    fn as_ngx_buf_mut(&mut self) -> *mut ngx_buf_t;

    // Provided methods
    fn as_bytes(&self) -> &[u8]  { ... }
    fn len(&self) -> usize { ... }
    fn is_empty(&self) -> bool { ... }
    fn set_last_buf(&mut self, last: bool) { ... }
    fn set_last_in_chain(&mut self, last: bool) { ... }
}
Expand description

The Buffer trait provides methods for working with an nginx buffer (ngx_buf_t).

See https://nginx.org/en/docs/dev/development_guide.html#buffer

Required Methods§

Source

fn as_ngx_buf(&self) -> *const ngx_buf_t

Returns a raw pointer to the underlying ngx_buf_t of the buffer.

Source

fn as_ngx_buf_mut(&mut self) -> *mut ngx_buf_t

Returns a mutable raw pointer to the underlying ngx_buf_t of the buffer.

Provided Methods§

Source

fn as_bytes(&self) -> &[u8]

Returns the buffer contents as a byte slice.

Source

fn len(&self) -> usize

Returns the length of the buffer contents.

Source

fn is_empty(&self) -> bool

Returns true if the buffer is empty, i.e., it has zero length.

Source

fn set_last_buf(&mut self, last: bool)

Sets the last_buf flag of the buffer.

§Arguments
  • last - A boolean indicating whether the buffer is the last buffer in a request.
Source

fn set_last_in_chain(&mut self, last: bool)

Sets the last_in_chain flag of the buffer.

§Arguments
  • last - A boolean indicating whether the buffer is the last buffer in a chain of buffers.

Implementors§