#![allow(unused_variables)]
use crate::{
ffvariants,
ll::bytecode::{FunctionParameterCount, MethodParameterCount},
wrap_in_language_error, Arguments, ForeignFunction, IntoValue, MutSelfFromRawValue,
RawForeignFunction, RawSelf, SelfFromRawValue, TryFromValue,
};
impl<Fun, Ret> ForeignFunction<ffvariants::Infallible<()>> for Fun
where
Fun: Fn() -> Ret + 'static,
Ret: IntoValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(0);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let result = self();
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err> ForeignFunction<ffvariants::Fallible<()>> for Fun
where
Fun: Fn() -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(0);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let result = self();
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>,)>> for Fun
where
Fun: Fn(RawSelf<'_>) -> Ret + 'static,
Ret: IntoValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let result = self(arg_self);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err> ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>,)>> for Fun
where
Fun: Fn(RawSelf<'_>) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let result = self(arg_self);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv>
ForeignFunction<ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv,)>> for Fun
where
Fun: Fn(&Recv) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let result = self(arg_self);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv>
ForeignFunction<ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv,)>> for Fun
where
Fun: Fn(&mut Recv) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let result = self(arg_self);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv,)>> for Fun
where
Fun: Fn(&Recv) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let result = self(arg_self);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv,)>> for Fun
where
Fun: Fn(&mut Recv) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let result = self(arg_self);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A> ForeignFunction<ffvariants::Infallible<(A,)>> for Fun
where
Fun: Fn(A) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(1);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let result = self(arg_0);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A> ForeignFunction<ffvariants::Fallible<(A,)>> for Fun
where
Fun: Fn(A) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(1);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let result = self(arg_0);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A)>> for Fun
where
Fun: Fn(RawSelf<'_>, A) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let result = self(arg_self, arg_0);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A> ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A)>> for Fun
where
Fun: Fn(RawSelf<'_>, A) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let result = self(arg_self, arg_0);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv, A>
ForeignFunction<ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A)>> for Fun
where
Fun: Fn(&Recv, A) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let result = self(arg_self, arg_0);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv, A>
ForeignFunction<ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A)>>
for Fun
where
Fun: Fn(&mut Recv, A) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let result = self(arg_self, arg_0);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv, A>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A)>> for Fun
where
Fun: Fn(&Recv, A) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let result = self(arg_self, arg_0);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv, A>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A)>> for Fun
where
Fun: Fn(&mut Recv, A) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let result = self(arg_self, arg_0);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B> ForeignFunction<ffvariants::Infallible<(A, B)>> for Fun
where
Fun: Fn(A, B) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(2);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let result = self(arg_0, arg_1);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B> ForeignFunction<ffvariants::Fallible<(A, B)>> for Fun
where
Fun: Fn(A, B) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(2);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let result = self(arg_0, arg_1);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let result = self(arg_self, arg_0, arg_1);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B> ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let result = self(arg_self, arg_0, arg_1);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv, A, B>
ForeignFunction<ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B)>>
for Fun
where
Fun: Fn(&Recv, A, B) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let result = self(arg_self, arg_0, arg_1);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv, A, B>
ForeignFunction<ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B)>>
for Fun
where
Fun: Fn(&mut Recv, A, B) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let result = self(arg_self, arg_0, arg_1);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv, A, B>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B)>>
for Fun
where
Fun: Fn(&Recv, A, B) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let result = self(arg_self, arg_0, arg_1);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv, A, B>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B)>>
for Fun
where
Fun: Fn(&mut Recv, A, B) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let result = self(arg_self, arg_0, arg_1);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C> ForeignFunction<ffvariants::Infallible<(A, B, C)>> for Fun
where
Fun: Fn(A, B, C) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(3);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let result = self(arg_0, arg_1, arg_2);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C> ForeignFunction<ffvariants::Fallible<(A, B, C)>> for Fun
where
Fun: Fn(A, B, C) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(3);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let result = self(arg_0, arg_1, arg_2);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C)>>
for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let result = self(arg_self, arg_0, arg_1, arg_2);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C> ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C)>>
for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let result = self(arg_self, arg_0, arg_1, arg_2);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv, A, B, C>
ForeignFunction<ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C)>>
for Fun
where
Fun: Fn(&Recv, A, B, C) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let result = self(arg_self, arg_0, arg_1, arg_2);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv, A, B, C>
ForeignFunction<ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C)>>
for Fun
where
Fun: Fn(&mut Recv, A, B, C) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let result = self(arg_self, arg_0, arg_1, arg_2);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C)>>
for Fun
where
Fun: Fn(&Recv, A, B, C) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let result = self(arg_self, arg_0, arg_1, arg_2);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C)>>
for Fun
where
Fun: Fn(&mut Recv, A, B, C) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let result = self(arg_self, arg_0, arg_1, arg_2);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D> ForeignFunction<ffvariants::Infallible<(A, B, C, D)>> for Fun
where
Fun: Fn(A, B, C, D) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(4);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let result = self(arg_0, arg_1, arg_2, arg_3);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D> ForeignFunction<ffvariants::Fallible<(A, B, C, D)>> for Fun
where
Fun: Fn(A, B, C, D) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(4);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let result = self(arg_0, arg_1, arg_2, arg_3);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D)>>
for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D>
ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D>
ForeignFunction<
ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D)>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D>
ForeignFunction<
ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D)>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D>
ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D)>>
for Fun
where
Fun: Fn(&Recv, A, B, C, D) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D>
ForeignFunction<
ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D)>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D, E> ForeignFunction<ffvariants::Infallible<(A, B, C, D, E)>> for Fun
where
Fun: Fn(A, B, C, D, E) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(5);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let result = self(arg_0, arg_1, arg_2, arg_3, arg_4);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D, E> ForeignFunction<ffvariants::Fallible<(A, B, C, D, E)>> for Fun
where
Fun: Fn(A, B, C, D, E) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(5);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let result = self(arg_0, arg_1, arg_2, arg_3, arg_4);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D, E>
ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D, E)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D, E) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D, E>
ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D, E)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D, E) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D, E>
ForeignFunction<
ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E)>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D, E) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D, E>
ForeignFunction<
ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E)>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D, E) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D, E>
ForeignFunction<
ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E)>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D, E) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D, E>
ForeignFunction<
ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E)>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D, E) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D, E, F> ForeignFunction<ffvariants::Infallible<(A, B, C, D, E, F)>> for Fun
where
Fun: Fn(A, B, C, D, E, F) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(6);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D, E, F> ForeignFunction<ffvariants::Fallible<(A, B, C, D, E, F)>>
for Fun
where
Fun: Fn(A, B, C, D, E, F) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(6);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D, E, F>
ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D, E, F) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D, E, F>
ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D, E, F) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D, E, F>
ForeignFunction<
ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F)>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D, E, F) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D, E, F>
ForeignFunction<
ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E, F)>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D, E, F) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D, E, F>
ForeignFunction<
ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F)>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D, E, F) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D, E, F>
ForeignFunction<
ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E, F)>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D, E, F) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D, E, F, G> ForeignFunction<ffvariants::Infallible<(A, B, C, D, E, F, G)>>
for Fun
where
Fun: Fn(A, B, C, D, E, F, G) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(7);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D, E, F, G>
ForeignFunction<ffvariants::Fallible<(A, B, C, D, E, F, G)>> for Fun
where
Fun: Fn(A, B, C, D, E, F, G) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(7);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D, E, F, G>
ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F, G)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D, E, F, G) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D, E, F, G>
ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F, G)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D, E, F, G) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D, E, F, G>
ForeignFunction<
ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F, G)>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D, E, F, G) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D, E, F, G>
ForeignFunction<
ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E, F, G)>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D, E, F, G) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D, E, F, G>
ForeignFunction<
ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F, G)>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D, E, F, G) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D, E, F, G>
ForeignFunction<
ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E, F, G)>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D, E, F, G) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D, E, F, G, H>
ForeignFunction<ffvariants::Infallible<(A, B, C, D, E, F, G, H)>> for Fun
where
Fun: Fn(A, B, C, D, E, F, G, H) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
H: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(8);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let arg_7 = wrap_in_language_error(arguments.get(7))?;
let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D, E, F, G, H>
ForeignFunction<ffvariants::Fallible<(A, B, C, D, E, F, G, H)>> for Fun
where
Fun: Fn(A, B, C, D, E, F, G, H) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
H: TryFromValue + 'static,
{
type ParameterCount = FunctionParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(8);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let arg_7 = wrap_in_language_error(arguments.get(7))?;
let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, A, B, C, D, E, F, G, H>
ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F, G, H)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D, E, F, G, H) -> Ret + 'static,
Ret: IntoValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
H: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let arg_7 = wrap_in_language_error(arguments.get(7))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, A, B, C, D, E, F, G, H>
ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F, G, H)>> for Fun
where
Fun: Fn(RawSelf<'_>, A, B, C, D, E, F, G, H) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
H: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let arg_self = RawSelf(arguments.raw_self());
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let arg_7 = wrap_in_language_error(arguments.get(7))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D, E, F, G, H>
ForeignFunction<
ffvariants::InfallibleSelf<
ffvariants::ImmutableSelf<Recv>,
(&Recv, A, B, C, D, E, F, G, H),
>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D, E, F, G, H) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
H: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let arg_7 = wrap_in_language_error(arguments.get(7))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Recv, A, B, C, D, E, F, G, H>
ForeignFunction<
ffvariants::InfallibleSelf<
ffvariants::MutableSelf<Recv>,
(&mut Recv, A, B, C, D, E, F, G, H),
>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D, E, F, G, H) -> Ret + 'static,
Ret: IntoValue + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
H: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let arg_7 = wrap_in_language_error(arguments.get(7))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
Ok(result.into_value_with_environment(env).to_raw(gc))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D, E, F, G, H>
ForeignFunction<
ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F, G, H)>,
> for Fun
where
Fun: Fn(&Recv, A, B, C, D, E, F, G, H) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: SelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
H: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let arg_7 = wrap_in_language_error(arguments.get(7))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}
impl<Fun, Ret, Err, Recv, A, B, C, D, E, F, G, H>
ForeignFunction<
ffvariants::FallibleSelf<
ffvariants::MutableSelf<Recv>,
(&mut Recv, A, B, C, D, E, F, G, H),
>,
> for Fun
where
Fun: Fn(&mut Recv, A, B, C, D, E, F, G, H) -> Result<Ret, Err> + 'static,
Ret: IntoValue + 'static,
Err: std::error::Error + 'static,
Recv: MutSelfFromRawValue + 'static,
A: TryFromValue + 'static,
B: TryFromValue + 'static,
C: TryFromValue + 'static,
D: TryFromValue + 'static,
E: TryFromValue + 'static,
F: TryFromValue + 'static,
G: TryFromValue + 'static,
H: TryFromValue + 'static,
{
type ParameterCount = MethodParameterCount;
const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
fn into_raw_foreign_function(self) -> RawForeignFunction {
Box::new(move |env, gc, args| {
let arguments = Arguments::new(args, env);
let (arg_self, _guard) = wrap_in_language_error(unsafe {
<Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
})?;
let arg_0 = wrap_in_language_error(arguments.get(0))?;
let arg_1 = wrap_in_language_error(arguments.get(1))?;
let arg_2 = wrap_in_language_error(arguments.get(2))?;
let arg_3 = wrap_in_language_error(arguments.get(3))?;
let arg_4 = wrap_in_language_error(arguments.get(4))?;
let arg_5 = wrap_in_language_error(arguments.get(5))?;
let arg_6 = wrap_in_language_error(arguments.get(6))?;
let arg_7 = wrap_in_language_error(arguments.get(7))?;
let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
})
}
}