SquirrelFn

Struct SquirrelFn 

Source
pub struct SquirrelFn<'a, T: IntoSquirrelArgs> { /* private fields */ }
Expand description

provides invariance for calling squirrel functions with little overhead

Implementations§

Source§

impl<'a, T: IntoSquirrelArgs> SquirrelFn<'a, T>

Source

pub const unsafe fn new_unchecked(obj: SQHandle<'a, SQClosure>) -> Self

creates a new SquirrelFn using the invariance of SQHandle<SQClosure>

§Safety

doesn’t check if the function passed has the correct args and return type

Source

pub fn run( &mut self, sqvm: NonNull<HSquirrelVM>, sqfunctions: &'static SquirrelFunctions, args: T, ) -> Result<(), CallError>

calls the underlying squirrel function on the provided sqvm

§Errors

This function will return an error if the fails to execute for some reason which is unlikely since it would be type checked

Source

pub fn call( &mut self, sqvm: NonNull<HSquirrelVM>, sqfunctions: &'static SquirrelFunctions, args: T, ) -> Result<(), CallError>

calls the underlying squirrel function on the provided sqvm

§Errors

This function will return an error if the fails to execute for some reason which is unlikely since it would be type checked

Trait Implementations§

Source§

impl<'a, T: IntoSquirrelArgs> AsRef<SQHandle<'a, SQClosure>> for SquirrelFn<'a, T>

Source§

fn as_ref(&self) -> &SQHandle<'a, SQClosure>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: IntoSquirrelArgs> GetFromSQObject for SquirrelFn<'_, T>

Source§

fn get_from_sqobject(obj: &SQObject) -> Self

gets the value out of a sqobject Read more
Source§

impl<T: IntoSquirrelArgs> GetFromSquirrelVm for SquirrelFn<'_, T>

Source§

fn get_from_sqvm( sqvm: NonNull<HSquirrelVM>, sqfunctions: &'static SquirrelFunctions, stack_pos: i32, ) -> Self

tries to get the value out of the squirrel stack but it cannot fail so this can panic Read more
Source§

impl<T: SQVMName + IntoSquirrelArgs> SQVMName for SquirrelFn<'_, T>

Source§

fn get_sqvm_name() -> String

the name on the sqvm of a type Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for SquirrelFn<'a, T>

§

impl<'a, T> RefUnwindSafe for SquirrelFn<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> !Send for SquirrelFn<'a, T>

§

impl<'a, T> !Sync for SquirrelFn<'a, T>

§

impl<'a, T> Unpin for SquirrelFn<'a, T>

§

impl<'a, T> UnwindSafe for SquirrelFn<'a, T>
where T: RefUnwindSafe,

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.