Struct haproxy_api::Channel 
source · pub struct Channel<'lua> { /* private fields */ }Expand description
The “Channel” class contains all functions to manipulate channels.
Please refer to HAProxy documentation to get more information.
Implementations§
source§impl<'lua> Channel<'lua>
 
impl<'lua> Channel<'lua>
sourcepub fn append(&self, data: impl AsRef<[u8]>) -> Result<isize>
 
pub fn append(&self, data: impl AsRef<[u8]>) -> Result<isize>
Copies the string string at the end of incoming data of the channel buffer. Returns the copied length on success or -1 if data cannot be copied.
sourcepub fn data(
    &self,
    offset: Option<isize>,
    length: Option<isize>
) -> Result<Option<LuaString<'_>>>
 
pub fn data( &self, offset: Option<isize>, length: Option<isize> ) -> Result<Option<LuaString<'_>>>
Returns length bytes of incoming data from the channel buffer, starting at the offset.
The data are not removed from the buffer.
sourcepub fn forward(&self, length: usize) -> Result<usize>
 
pub fn forward(&self, length: usize) -> Result<usize>
Forwards length bytes of data from the channel buffer.
Returns the amount of data forwarded and must not be called from an action to avoid yielding.
sourcepub fn input(&self) -> Result<usize>
 
pub fn input(&self) -> Result<usize>
Returns the length of incoming data in the channel buffer.
sourcepub fn insert(
    &self,
    data: impl AsRef<[u8]>,
    offset: Option<isize>
) -> Result<isize>
 
pub fn insert( &self, data: impl AsRef<[u8]>, offset: Option<isize> ) -> Result<isize>
Copies the data at the offset in incoming data of the channel buffer.
Returns the copied length on success or -1 if data cannot be copied.
By default, if no offset is provided, the string is copied in front of incoming data.
A positive offset is relative to the beginning of incoming data of the channel buffer while negative offset is relative to their end.
sourcepub fn line(
    &self,
    offset: Option<isize>,
    length: Option<isize>
) -> Result<Option<LuaString<'_>>>
 
pub fn line( &self, offset: Option<isize>, length: Option<isize> ) -> Result<Option<LuaString<'_>>>
Parses length bytes of incoming data of the channel buffer, starting at offset,
and returns the first line found, including the \n.
The data are not removed from the buffer. If no line is found, all data are returned.
sourcepub fn output(&self) -> Result<usize>
 
pub fn output(&self) -> Result<usize>
Returns the length of outgoing data of the channel buffer.
sourcepub fn prepend(&self, data: impl AsRef<[u8]>) -> Result<isize>
 
pub fn prepend(&self, data: impl AsRef<[u8]>) -> Result<isize>
Copies the data in front of incoming data of the channel buffer.
Returns the copied length on success or -1 if data cannot be copied.
sourcepub fn remove(
    &self,
    offset: Option<isize>,
    length: Option<usize>
) -> Result<isize>
 
pub fn remove( &self, offset: Option<isize>, length: Option<usize> ) -> Result<isize>
Removes length bytes of incoming data of the channel buffer, starting at offset.
Returns number of bytes removed on success.