pub fn call<A, T>(&self, args: A) -> Result<T, VmError>
    where
        A: Args,
        T: FromValue,
    {
        let value = match &self.inner {
            Inner::FnHandler(handler) => {
                let arg_count = args.count();
                let mut stack = Stack::with_capacity(arg_count);
                args.into_stack(&mut stack)?;
                (handler.handler)(&mut stack, arg_count)?;
                stack.pop()?
            }
            Inner::FnOffset(fn_offset) => fn_offset.call(args, ())?,
            Inner::FnClosureOffset(closure) => closure
                .fn_offset
                .call(args, (Tuple::from(closure.environment.clone()),))?,
            Inner::FnUnitStruct(empty) => {
                Self::check_args(args.count(), 0)?;
                Value::unit_struct(empty.rtti.clone())
            }
            Inner::FnTupleStruct(tuple) => {
                Self::check_args(args.count(), tuple.args)?;
                Value::tuple_struct(tuple.rtti.clone(), args.into_vec()?)
            }
            Inner::FnUnitVariant(unit) => {
                Self::check_args(args.count(), 0)?;
                Value::unit_variant(unit.rtti.clone())
            }
            Inner::FnTupleVariant(tuple) => {
                Self::check_args(args.count(), tuple.args)?;
                Value::tuple_variant(tuple.rtti.clone(), args.into_vec()?)
            }
        };

        T::from_value(value)
    }
/// Perform a call over the function represented by this function pointer.
Perform a call over the function represented by this function pointer.
Perform a call over the function represented by this function pointer .
pub fn call<A, T>(&self, args: A) -> Result<T, VmError>
    where
        A: Args,
        T: FromValue,
    {
        let value = match &self.inner {
            Inner::FnHandler(handler) => {
                let arg_count = args.count();
                let mut stack = Stack::with_capacity(arg_count);
                args.into_stack(&mut stack)?;
                (handler.handler)(&mut stack, arg_count)?;
                stack.pop()?
            }
            Inner::FnOffset(fn_offset) => fn_offset.call(args, ())?,
            Inner::FnClosureOffset(closure) => closure
                .fn_offset
                .call(args, (Tuple::from(closure.environment.clone()),))?,
            Inner::FnUnitStruct(empty) => {
                Self::check_args(args.count(), 0)?;
                Value::unit_struct(empty.rtti.clone())
            }
            Inner::FnTupleStruct(tuple) => {
                Self::check_args(args.count(), tuple.args)?;
                Value::tuple_struct(tuple.rtti.clone(), args.into_vec()?)
            }
            Inner::FnUnitVariant(unit) => {
                Self::check_args(args.count(), 0)?;
                Value::unit_variant(unit.rtti.clone())
            }
            Inner::FnTupleVariant(tuple) => {
                Self::check_args(args.count(), tuple.args)?;
                Value::tuple_variant(tuple.rtti.clone(), args.into_vec()?)
            }
        };
        T::from_value(value)
    }
pub fn call < A , T > ( & self , args : A ) -> Result < T , VmError > where A : Args , T : FromValue , { let value = match & self . inner { Inner :: FnHandler ( handler ) => { let arg_count = args . count ( ) ; let mut stack = Stack :: with_capacity ( arg_count ) ; args . into_stack ( & mut stack ) ? ; ( handler . handler ) ( & mut stack , arg_count ) ? ; stack . pop ( ) ? } Inner :: FnOffset ( fn_offset ) => fn_offset . call ( args , ( ) ) ? , Inner :: FnClosureOffset ( closure ) => closure . fn_offset . call ( args , ( Tuple :: from ( closure . environment . clone ( ) ) , ) ) ? , Inner :: FnUnitStruct ( empty ) => { Self :: check_args ( args . count ( ) , 0 ) ? ; Value :: unit_struct ( empty . rtti . clone ( ) ) } Inner :: FnTupleStruct ( tuple ) => { Self :: check_args ( args . count ( ) , tuple . args ) ? ; Value :: tuple_struct ( tuple . rtti . clone ( ) , args . into_vec ( ) ? ) } Inner :: FnUnitVariant ( unit ) => { Self :: check_args ( args . count ( ) , 0 ) ? ; Value :: unit_variant ( unit . rtti . clone ( ) ) } Inner :: FnTupleVariant ( tuple ) => { Self :: check_args ( args . count ( ) , tuple . args ) ? ; Value :: tuple_variant ( tuple . rtti . clone ( ) , args . into_vec ( ) ? ) } } ; T :: from_value ( value ) }
Perform a call over the function represented by this function pointer.
Perform a call over the function represented by this function pointer .
&self
args
A
&self
args
A