Struct haproxy_api::Txn

source ·
pub struct Txn<'lua> {
    pub c: Converters<'lua>,
    pub f: Fetches<'lua>,
    /* private fields */
}
Expand description

The txn class contain all the functions relative to the http or tcp transaction.

Fields§

§c: Converters<'lua>§f: Fetches<'lua>

Implementations§

source§

impl<'lua> Txn<'lua>

source

pub fn http(&self) -> Result<Http<'lua>>

Returns an HTTP class object.

source

pub fn log(&self, level: LogLevel, msg: impl AsRef<str>) -> Result<()>

Sends a log on the default syslog server if it is configured and on the stderr if it is allowed.

source

pub fn deflog<S>(&self, msg: &S) -> Result<()>where S: AsRef<str> + ?Sized,

Sends a log line with the default loglevel for the proxy associated with the transaction.

source

pub fn get_priv<R: FromLua<'lua>>(&self) -> Result<R>

Returns data stored in the current transaction (with the set_priv()) function.

source

pub fn set_priv<A: IntoLua<'lua>>(&self, val: A) -> Result<()>

Stores any data in the current HAProxy transaction. This action replaces the old stored data.

source

pub fn get_var<R: FromLua<'lua>>(&self, name: &str) -> Result<R>

Returns data stored in the variable name.

source

pub fn set_var<A: IntoLua<'lua>>(&self, name: &str, val: A) -> Result<()>

Store variable name in an HAProxy converting the type.

source

pub fn unset_var(&self, name: &str) -> Result<()>

Unsets the variable name.

source

pub fn set_loglevel(&self, level: LogLevel) -> Result<()>

Changes the log level of the current request. The level must be an integer between 0 and 7.

Trait Implementations§

source§

impl<'lua> Clone for Txn<'lua>

source§

fn clone(&self) -> Txn<'lua>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'lua> FromLua<'lua> for Txn<'lua>

source§

fn from_lua(value: Value<'lua>, lua: &'lua Lua) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl<'lua> !RefUnwindSafe for Txn<'lua>

§

impl<'lua> !Send for Txn<'lua>

§

impl<'lua> !Sync for Txn<'lua>

§

impl<'lua> Unpin for Txn<'lua>

§

impl<'lua> !UnwindSafe for Txn<'lua>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<'lua, T> FromLuaMulti<'lua> for Twhere T: FromLua<'lua>,

source§

fn from_lua_multi(values: MultiValue<'lua>, lua: &'lua Lua) -> Result<T, Error>

Performs the conversion. Read more
source§

fn from_lua_args( args: MultiValue<'lua>, i: usize, to: Option<&str>, lua: &'lua Lua ) -> Result<T, Error>

source§

unsafe fn from_stack_multi(nvals: i32, lua: &'lua Lua) -> Result<T, Error>

source§

unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &'lua Lua ) -> Result<T, Error>

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.