haproxy_api/
event_sub.rs

1use std::ops::Deref;
2
3use mlua::{FromLua, Lua, ObjectLike, Result, Table, Value};
4
5/// The "EventSub" class that can be used to manipulate HAProxy subscription.
6#[derive(Clone)]
7pub struct EventSub(Table);
8
9impl EventSub {
10    /// Returns stick table attributes as a Lua table.
11    #[inline]
12    pub fn unsub(&self) -> Result<Table> {
13        self.0.call_method("unsub", ())
14    }
15}
16
17impl FromLua for EventSub {
18    #[inline]
19    fn from_lua(value: Value, lua: &Lua) -> Result<Self> {
20        let class = Table::from_lua(value, lua)?;
21        Ok(EventSub(class))
22    }
23}
24
25impl Deref for EventSub {
26    type Target = Table;
27
28    #[inline]
29    fn deref(&self) -> &Self::Target {
30        &self.0
31    }
32}