Extension

Struct Extension 

Source
pub struct Extension<W: Debug + Default> {
    pub info: ExtensionInfo,
    pub args: Vec<String>,
    pub globals: W,
    /* private fields */
}

Fields§

§info: ExtensionInfo§args: Vec<String>§globals: W

Implementations§

Source§

impl<W: Debug + Default + 'static> Extension<W>

Source

pub fn new() -> Self

Source

pub fn run(&mut self)

Source

pub fn get_packet_info_manager(&self) -> Option<PacketInfoManager>

Source

pub fn get_host_info(&self) -> Option<HostInfo>

Source

pub fn write_to_console(&self, s: String)

Source

pub fn write_to_console_formatted(&self, s: String, colour: ConsoleColour)

Source

pub fn on_init(&mut self, listener: fn(ext: &mut Self))

Source

pub fn on_socket_disconnect(&mut self, listener: fn(ext: &mut Self))

Source

pub fn on_connect( &mut self, listener: fn(ext: &mut Self, connection_info: ConnectionInfo), )

Source

pub fn on_start(&mut self, listener: fn(ext: &mut Self))

Source

pub fn on_end(&mut self, listener: fn(ext: &mut Self))

Source

pub fn on_host_info_update( &mut self, listener: fn(ext: &mut Self, host_info: HostInfo), )

Source

pub fn on_click(&mut self, listener: fn(ext: &mut Self))

Source

pub fn request_flags( &mut self, callback: fn(ext: &mut Self, flags: Vec<String>), )

Source

pub fn intercept<T: BaseParser + 'static>( &mut self, listener: fn(ext: &mut Self, msg: &mut HMessage, object: &mut T), )

Source

pub fn intercept_by_id<T: BaseParser + 'static>( &mut self, id: i32, listener: fn(ext: &mut Self, msg: &mut HMessage, object: &mut T), )

Source

pub fn intercept_raw<I: InterceptIndicator>( &mut self, direction: HDirection, indicator: I, listener: impl Fn(&mut Self, &mut HMessage) + Send + Sync + 'static, )

Source

pub fn send_to_client(&self, packet: HPacket) -> bool

Source

pub fn send_to_server(&self, packet: HPacket) -> bool

Source

pub fn send<B: BaseParser>(&self, packet_object: B) -> bool

Source

pub fn send_with_id<B: BaseParser>( &self, packet_object: B, header_id: i32, ) -> bool

Trait Implementations§

Source§

impl<W: Debug + Default> Debug for Extension<W>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<W> Freeze for Extension<W>
where W: Freeze,

§

impl<W> !RefUnwindSafe for Extension<W>

§

impl<W> Send for Extension<W>
where W: Send,

§

impl<W> Sync for Extension<W>
where W: Sync,

§

impl<W> Unpin for Extension<W>
where W: Unpin,

§

impl<W> !UnwindSafe for Extension<W>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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<T, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.