Extension

Struct Extension 

Source
pub struct Extension(/* private fields */);
Expand description

Wrapper around crate::Extension used for testing.

Implementations§

Source§

impl Extension

Source

pub fn new(ext: Extension) -> Self

Create a new testing Extension

Source

pub fn context(&self) -> Context

Returns a context for simulating interactions with Arma

Source

pub fn state(&self) -> &State

Get a reference to the extensions state container

Source

pub fn call_with_context( &self, function: &str, args: Option<Vec<String>>, caller: Caller, source: Source, mission: Mission, server: Server, remote_exec_owner: i16, ) -> (String, c_int)

Call a function with Arma call context.

§Safety

This function is unsafe because it interacts with the C API.

Source

pub fn call(&self, function: &str, args: Option<Vec<String>>) -> (String, c_int)

Call a function without Arma call context.

§Safety

This function is unsafe because it interacts with the C API.

§Note

If the call-context feature is enabled, this function passes default values for each field.

Source

pub fn callback_handler<F, T, E>( &self, handler: F, timeout: Duration, ) -> Result<T, E>
where F: Fn(&str, &str, Option<Value>) -> Result<T, E>,

Create a callback handler

Returns a Result from the handler if the callback was handled, or Result::Timeout if either no event was received, or the handler returned Result::Continue until the timeout was reached.

The handler must return a Result indicating the callback was handled to exit Result::Continue will continue to provide events to the handler until another variant is returned

Auto Trait Implementations§

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.