mica/hl/generated/
function_variants.rs

1// Generated by mica xtask. Do not modify directly.
2// Edit xtask/src/codegen/function_variants.rs instead, and regenerate with:
3//  $ cargo xtask codegen
4
5#![allow(unused_variables)]
6
7use crate::{
8    ffvariants,
9    ll::bytecode::{FunctionParameterCount, MethodParameterCount},
10    wrap_in_language_error, Arguments, ForeignFunction, IntoValue, MutSelfFromRawValue,
11    RawForeignFunction, RawSelf, SelfFromRawValue, TryFromValue,
12};
13
14impl<Fun, Ret> ForeignFunction<ffvariants::Infallible<()>> for Fun
15where
16    Fun: Fn() -> Ret + 'static,
17    Ret: IntoValue + 'static,
18{
19    type ParameterCount = FunctionParameterCount;
20    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(0);
21
22    fn into_raw_foreign_function(self) -> RawForeignFunction {
23        Box::new(move |env, gc, args| {
24            let arguments = Arguments::new(args, env);
25            let result = self();
26
27            Ok(result.into_value_with_environment(env).to_raw(gc))
28        })
29    }
30}
31
32impl<Fun, Ret, Err> ForeignFunction<ffvariants::Fallible<()>> for Fun
33where
34    Fun: Fn() -> Result<Ret, Err> + 'static,
35    Ret: IntoValue + 'static,
36    Err: std::error::Error + 'static,
37{
38    type ParameterCount = FunctionParameterCount;
39    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(0);
40
41    fn into_raw_foreign_function(self) -> RawForeignFunction {
42        Box::new(move |env, gc, args| {
43            let arguments = Arguments::new(args, env);
44            let result = self();
45
46            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
47        })
48    }
49}
50
51impl<Fun, Ret> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>,)>> for Fun
52where
53    Fun: Fn(RawSelf<'_>) -> Ret + 'static,
54    Ret: IntoValue + 'static,
55{
56    type ParameterCount = MethodParameterCount;
57    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
58
59    fn into_raw_foreign_function(self) -> RawForeignFunction {
60        Box::new(move |env, gc, args| {
61            let arguments = Arguments::new(args, env);
62            let arg_self = RawSelf(arguments.raw_self());
63
64            let result = self(arg_self);
65
66            Ok(result.into_value_with_environment(env).to_raw(gc))
67        })
68    }
69}
70
71impl<Fun, Ret, Err> ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>,)>> for Fun
72where
73    Fun: Fn(RawSelf<'_>) -> Result<Ret, Err> + 'static,
74    Ret: IntoValue + 'static,
75    Err: std::error::Error + 'static,
76{
77    type ParameterCount = MethodParameterCount;
78    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
79
80    fn into_raw_foreign_function(self) -> RawForeignFunction {
81        Box::new(move |env, gc, args| {
82            let arguments = Arguments::new(args, env);
83            let arg_self = RawSelf(arguments.raw_self());
84
85            let result = self(arg_self);
86
87            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
88        })
89    }
90}
91
92impl<Fun, Ret, Recv>
93    ForeignFunction<ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv,)>> for Fun
94where
95    Fun: Fn(&Recv) -> Ret + 'static,
96    Ret: IntoValue + 'static,
97    Recv: SelfFromRawValue + 'static,
98{
99    type ParameterCount = MethodParameterCount;
100    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
101
102    fn into_raw_foreign_function(self) -> RawForeignFunction {
103        Box::new(move |env, gc, args| {
104            let arguments = Arguments::new(args, env);
105            let (arg_self, _guard) = wrap_in_language_error(unsafe {
106                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
107            })?;
108
109            let result = self(arg_self);
110
111            Ok(result.into_value_with_environment(env).to_raw(gc))
112        })
113    }
114}
115
116impl<Fun, Ret, Recv>
117    ForeignFunction<ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv,)>> for Fun
118where
119    Fun: Fn(&mut Recv) -> Ret + 'static,
120    Ret: IntoValue + 'static,
121    Recv: MutSelfFromRawValue + 'static,
122{
123    type ParameterCount = MethodParameterCount;
124    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
125
126    fn into_raw_foreign_function(self) -> RawForeignFunction {
127        Box::new(move |env, gc, args| {
128            let arguments = Arguments::new(args, env);
129            let (arg_self, _guard) = wrap_in_language_error(unsafe {
130                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
131            })?;
132
133            let result = self(arg_self);
134
135            Ok(result.into_value_with_environment(env).to_raw(gc))
136        })
137    }
138}
139
140impl<Fun, Ret, Err, Recv>
141    ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv,)>> for Fun
142where
143    Fun: Fn(&Recv) -> Result<Ret, Err> + 'static,
144    Ret: IntoValue + 'static,
145    Err: std::error::Error + 'static,
146    Recv: SelfFromRawValue + 'static,
147{
148    type ParameterCount = MethodParameterCount;
149    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
150
151    fn into_raw_foreign_function(self) -> RawForeignFunction {
152        Box::new(move |env, gc, args| {
153            let arguments = Arguments::new(args, env);
154            let (arg_self, _guard) = wrap_in_language_error(unsafe {
155                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
156            })?;
157
158            let result = self(arg_self);
159
160            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
161        })
162    }
163}
164
165impl<Fun, Ret, Err, Recv>
166    ForeignFunction<ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv,)>> for Fun
167where
168    Fun: Fn(&mut Recv) -> Result<Ret, Err> + 'static,
169    Ret: IntoValue + 'static,
170    Err: std::error::Error + 'static,
171    Recv: MutSelfFromRawValue + 'static,
172{
173    type ParameterCount = MethodParameterCount;
174    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(1);
175
176    fn into_raw_foreign_function(self) -> RawForeignFunction {
177        Box::new(move |env, gc, args| {
178            let arguments = Arguments::new(args, env);
179            let (arg_self, _guard) = wrap_in_language_error(unsafe {
180                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
181            })?;
182
183            let result = self(arg_self);
184
185            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
186        })
187    }
188}
189
190impl<Fun, Ret, A> ForeignFunction<ffvariants::Infallible<(A,)>> for Fun
191where
192    Fun: Fn(A) -> Ret + 'static,
193    Ret: IntoValue + 'static,
194    A: TryFromValue + 'static,
195{
196    type ParameterCount = FunctionParameterCount;
197    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(1);
198
199    fn into_raw_foreign_function(self) -> RawForeignFunction {
200        Box::new(move |env, gc, args| {
201            let arguments = Arguments::new(args, env);
202            let arg_0 = wrap_in_language_error(arguments.get(0))?;
203
204            let result = self(arg_0);
205
206            Ok(result.into_value_with_environment(env).to_raw(gc))
207        })
208    }
209}
210
211impl<Fun, Ret, Err, A> ForeignFunction<ffvariants::Fallible<(A,)>> for Fun
212where
213    Fun: Fn(A) -> Result<Ret, Err> + 'static,
214    Ret: IntoValue + 'static,
215    Err: std::error::Error + 'static,
216    A: TryFromValue + 'static,
217{
218    type ParameterCount = FunctionParameterCount;
219    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(1);
220
221    fn into_raw_foreign_function(self) -> RawForeignFunction {
222        Box::new(move |env, gc, args| {
223            let arguments = Arguments::new(args, env);
224            let arg_0 = wrap_in_language_error(arguments.get(0))?;
225
226            let result = self(arg_0);
227
228            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
229        })
230    }
231}
232
233impl<Fun, Ret, A> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A)>> for Fun
234where
235    Fun: Fn(RawSelf<'_>, A) -> Ret + 'static,
236    Ret: IntoValue + 'static,
237    A: TryFromValue + 'static,
238{
239    type ParameterCount = MethodParameterCount;
240    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
241
242    fn into_raw_foreign_function(self) -> RawForeignFunction {
243        Box::new(move |env, gc, args| {
244            let arguments = Arguments::new(args, env);
245            let arg_self = RawSelf(arguments.raw_self());
246            let arg_0 = wrap_in_language_error(arguments.get(0))?;
247
248            let result = self(arg_self, arg_0);
249
250            Ok(result.into_value_with_environment(env).to_raw(gc))
251        })
252    }
253}
254
255impl<Fun, Ret, Err, A> ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A)>> for Fun
256where
257    Fun: Fn(RawSelf<'_>, A) -> Result<Ret, Err> + 'static,
258    Ret: IntoValue + 'static,
259    Err: std::error::Error + 'static,
260    A: TryFromValue + 'static,
261{
262    type ParameterCount = MethodParameterCount;
263    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
264
265    fn into_raw_foreign_function(self) -> RawForeignFunction {
266        Box::new(move |env, gc, args| {
267            let arguments = Arguments::new(args, env);
268            let arg_self = RawSelf(arguments.raw_self());
269            let arg_0 = wrap_in_language_error(arguments.get(0))?;
270
271            let result = self(arg_self, arg_0);
272
273            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
274        })
275    }
276}
277
278impl<Fun, Ret, Recv, A>
279    ForeignFunction<ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A)>> for Fun
280where
281    Fun: Fn(&Recv, A) -> Ret + 'static,
282    Ret: IntoValue + 'static,
283    Recv: SelfFromRawValue + 'static,
284    A: TryFromValue + 'static,
285{
286    type ParameterCount = MethodParameterCount;
287    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
288
289    fn into_raw_foreign_function(self) -> RawForeignFunction {
290        Box::new(move |env, gc, args| {
291            let arguments = Arguments::new(args, env);
292            let (arg_self, _guard) = wrap_in_language_error(unsafe {
293                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
294            })?;
295            let arg_0 = wrap_in_language_error(arguments.get(0))?;
296
297            let result = self(arg_self, arg_0);
298
299            Ok(result.into_value_with_environment(env).to_raw(gc))
300        })
301    }
302}
303
304impl<Fun, Ret, Recv, A>
305    ForeignFunction<ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A)>>
306    for Fun
307where
308    Fun: Fn(&mut Recv, A) -> Ret + 'static,
309    Ret: IntoValue + 'static,
310    Recv: MutSelfFromRawValue + 'static,
311    A: TryFromValue + 'static,
312{
313    type ParameterCount = MethodParameterCount;
314    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
315
316    fn into_raw_foreign_function(self) -> RawForeignFunction {
317        Box::new(move |env, gc, args| {
318            let arguments = Arguments::new(args, env);
319            let (arg_self, _guard) = wrap_in_language_error(unsafe {
320                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
321            })?;
322            let arg_0 = wrap_in_language_error(arguments.get(0))?;
323
324            let result = self(arg_self, arg_0);
325
326            Ok(result.into_value_with_environment(env).to_raw(gc))
327        })
328    }
329}
330
331impl<Fun, Ret, Err, Recv, A>
332    ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A)>> for Fun
333where
334    Fun: Fn(&Recv, A) -> Result<Ret, Err> + 'static,
335    Ret: IntoValue + 'static,
336    Err: std::error::Error + 'static,
337    Recv: SelfFromRawValue + 'static,
338    A: TryFromValue + 'static,
339{
340    type ParameterCount = MethodParameterCount;
341    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
342
343    fn into_raw_foreign_function(self) -> RawForeignFunction {
344        Box::new(move |env, gc, args| {
345            let arguments = Arguments::new(args, env);
346            let (arg_self, _guard) = wrap_in_language_error(unsafe {
347                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
348            })?;
349            let arg_0 = wrap_in_language_error(arguments.get(0))?;
350
351            let result = self(arg_self, arg_0);
352
353            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
354        })
355    }
356}
357
358impl<Fun, Ret, Err, Recv, A>
359    ForeignFunction<ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A)>> for Fun
360where
361    Fun: Fn(&mut Recv, A) -> Result<Ret, Err> + 'static,
362    Ret: IntoValue + 'static,
363    Err: std::error::Error + 'static,
364    Recv: MutSelfFromRawValue + 'static,
365    A: TryFromValue + 'static,
366{
367    type ParameterCount = MethodParameterCount;
368    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(2);
369
370    fn into_raw_foreign_function(self) -> RawForeignFunction {
371        Box::new(move |env, gc, args| {
372            let arguments = Arguments::new(args, env);
373            let (arg_self, _guard) = wrap_in_language_error(unsafe {
374                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
375            })?;
376            let arg_0 = wrap_in_language_error(arguments.get(0))?;
377
378            let result = self(arg_self, arg_0);
379
380            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
381        })
382    }
383}
384
385impl<Fun, Ret, A, B> ForeignFunction<ffvariants::Infallible<(A, B)>> for Fun
386where
387    Fun: Fn(A, B) -> Ret + 'static,
388    Ret: IntoValue + 'static,
389    A: TryFromValue + 'static,
390    B: TryFromValue + 'static,
391{
392    type ParameterCount = FunctionParameterCount;
393    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(2);
394
395    fn into_raw_foreign_function(self) -> RawForeignFunction {
396        Box::new(move |env, gc, args| {
397            let arguments = Arguments::new(args, env);
398            let arg_0 = wrap_in_language_error(arguments.get(0))?;
399            let arg_1 = wrap_in_language_error(arguments.get(1))?;
400
401            let result = self(arg_0, arg_1);
402
403            Ok(result.into_value_with_environment(env).to_raw(gc))
404        })
405    }
406}
407
408impl<Fun, Ret, Err, A, B> ForeignFunction<ffvariants::Fallible<(A, B)>> for Fun
409where
410    Fun: Fn(A, B) -> Result<Ret, Err> + 'static,
411    Ret: IntoValue + 'static,
412    Err: std::error::Error + 'static,
413    A: TryFromValue + 'static,
414    B: TryFromValue + 'static,
415{
416    type ParameterCount = FunctionParameterCount;
417    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(2);
418
419    fn into_raw_foreign_function(self) -> RawForeignFunction {
420        Box::new(move |env, gc, args| {
421            let arguments = Arguments::new(args, env);
422            let arg_0 = wrap_in_language_error(arguments.get(0))?;
423            let arg_1 = wrap_in_language_error(arguments.get(1))?;
424
425            let result = self(arg_0, arg_1);
426
427            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
428        })
429    }
430}
431
432impl<Fun, Ret, A, B> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B)>> for Fun
433where
434    Fun: Fn(RawSelf<'_>, A, B) -> Ret + 'static,
435    Ret: IntoValue + 'static,
436    A: TryFromValue + 'static,
437    B: TryFromValue + 'static,
438{
439    type ParameterCount = MethodParameterCount;
440    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
441
442    fn into_raw_foreign_function(self) -> RawForeignFunction {
443        Box::new(move |env, gc, args| {
444            let arguments = Arguments::new(args, env);
445            let arg_self = RawSelf(arguments.raw_self());
446            let arg_0 = wrap_in_language_error(arguments.get(0))?;
447            let arg_1 = wrap_in_language_error(arguments.get(1))?;
448
449            let result = self(arg_self, arg_0, arg_1);
450
451            Ok(result.into_value_with_environment(env).to_raw(gc))
452        })
453    }
454}
455
456impl<Fun, Ret, Err, A, B> ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B)>> for Fun
457where
458    Fun: Fn(RawSelf<'_>, A, B) -> Result<Ret, Err> + 'static,
459    Ret: IntoValue + 'static,
460    Err: std::error::Error + 'static,
461    A: TryFromValue + 'static,
462    B: TryFromValue + 'static,
463{
464    type ParameterCount = MethodParameterCount;
465    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
466
467    fn into_raw_foreign_function(self) -> RawForeignFunction {
468        Box::new(move |env, gc, args| {
469            let arguments = Arguments::new(args, env);
470            let arg_self = RawSelf(arguments.raw_self());
471            let arg_0 = wrap_in_language_error(arguments.get(0))?;
472            let arg_1 = wrap_in_language_error(arguments.get(1))?;
473
474            let result = self(arg_self, arg_0, arg_1);
475
476            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
477        })
478    }
479}
480
481impl<Fun, Ret, Recv, A, B>
482    ForeignFunction<ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B)>>
483    for Fun
484where
485    Fun: Fn(&Recv, A, B) -> Ret + 'static,
486    Ret: IntoValue + 'static,
487    Recv: SelfFromRawValue + 'static,
488    A: TryFromValue + 'static,
489    B: TryFromValue + 'static,
490{
491    type ParameterCount = MethodParameterCount;
492    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
493
494    fn into_raw_foreign_function(self) -> RawForeignFunction {
495        Box::new(move |env, gc, args| {
496            let arguments = Arguments::new(args, env);
497            let (arg_self, _guard) = wrap_in_language_error(unsafe {
498                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
499            })?;
500            let arg_0 = wrap_in_language_error(arguments.get(0))?;
501            let arg_1 = wrap_in_language_error(arguments.get(1))?;
502
503            let result = self(arg_self, arg_0, arg_1);
504
505            Ok(result.into_value_with_environment(env).to_raw(gc))
506        })
507    }
508}
509
510impl<Fun, Ret, Recv, A, B>
511    ForeignFunction<ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B)>>
512    for Fun
513where
514    Fun: Fn(&mut Recv, A, B) -> Ret + 'static,
515    Ret: IntoValue + 'static,
516    Recv: MutSelfFromRawValue + 'static,
517    A: TryFromValue + 'static,
518    B: TryFromValue + 'static,
519{
520    type ParameterCount = MethodParameterCount;
521    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
522
523    fn into_raw_foreign_function(self) -> RawForeignFunction {
524        Box::new(move |env, gc, args| {
525            let arguments = Arguments::new(args, env);
526            let (arg_self, _guard) = wrap_in_language_error(unsafe {
527                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
528            })?;
529            let arg_0 = wrap_in_language_error(arguments.get(0))?;
530            let arg_1 = wrap_in_language_error(arguments.get(1))?;
531
532            let result = self(arg_self, arg_0, arg_1);
533
534            Ok(result.into_value_with_environment(env).to_raw(gc))
535        })
536    }
537}
538
539impl<Fun, Ret, Err, Recv, A, B>
540    ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B)>>
541    for Fun
542where
543    Fun: Fn(&Recv, A, B) -> Result<Ret, Err> + 'static,
544    Ret: IntoValue + 'static,
545    Err: std::error::Error + 'static,
546    Recv: SelfFromRawValue + 'static,
547    A: TryFromValue + 'static,
548    B: TryFromValue + 'static,
549{
550    type ParameterCount = MethodParameterCount;
551    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
552
553    fn into_raw_foreign_function(self) -> RawForeignFunction {
554        Box::new(move |env, gc, args| {
555            let arguments = Arguments::new(args, env);
556            let (arg_self, _guard) = wrap_in_language_error(unsafe {
557                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
558            })?;
559            let arg_0 = wrap_in_language_error(arguments.get(0))?;
560            let arg_1 = wrap_in_language_error(arguments.get(1))?;
561
562            let result = self(arg_self, arg_0, arg_1);
563
564            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
565        })
566    }
567}
568
569impl<Fun, Ret, Err, Recv, A, B>
570    ForeignFunction<ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B)>>
571    for Fun
572where
573    Fun: Fn(&mut Recv, A, B) -> Result<Ret, Err> + 'static,
574    Ret: IntoValue + 'static,
575    Err: std::error::Error + 'static,
576    Recv: MutSelfFromRawValue + 'static,
577    A: TryFromValue + 'static,
578    B: TryFromValue + 'static,
579{
580    type ParameterCount = MethodParameterCount;
581    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(3);
582
583    fn into_raw_foreign_function(self) -> RawForeignFunction {
584        Box::new(move |env, gc, args| {
585            let arguments = Arguments::new(args, env);
586            let (arg_self, _guard) = wrap_in_language_error(unsafe {
587                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
588            })?;
589            let arg_0 = wrap_in_language_error(arguments.get(0))?;
590            let arg_1 = wrap_in_language_error(arguments.get(1))?;
591
592            let result = self(arg_self, arg_0, arg_1);
593
594            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
595        })
596    }
597}
598
599impl<Fun, Ret, A, B, C> ForeignFunction<ffvariants::Infallible<(A, B, C)>> for Fun
600where
601    Fun: Fn(A, B, C) -> Ret + 'static,
602    Ret: IntoValue + 'static,
603    A: TryFromValue + 'static,
604    B: TryFromValue + 'static,
605    C: TryFromValue + 'static,
606{
607    type ParameterCount = FunctionParameterCount;
608    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(3);
609
610    fn into_raw_foreign_function(self) -> RawForeignFunction {
611        Box::new(move |env, gc, args| {
612            let arguments = Arguments::new(args, env);
613            let arg_0 = wrap_in_language_error(arguments.get(0))?;
614            let arg_1 = wrap_in_language_error(arguments.get(1))?;
615            let arg_2 = wrap_in_language_error(arguments.get(2))?;
616
617            let result = self(arg_0, arg_1, arg_2);
618
619            Ok(result.into_value_with_environment(env).to_raw(gc))
620        })
621    }
622}
623
624impl<Fun, Ret, Err, A, B, C> ForeignFunction<ffvariants::Fallible<(A, B, C)>> for Fun
625where
626    Fun: Fn(A, B, C) -> Result<Ret, Err> + 'static,
627    Ret: IntoValue + 'static,
628    Err: std::error::Error + 'static,
629    A: TryFromValue + 'static,
630    B: TryFromValue + 'static,
631    C: TryFromValue + 'static,
632{
633    type ParameterCount = FunctionParameterCount;
634    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(3);
635
636    fn into_raw_foreign_function(self) -> RawForeignFunction {
637        Box::new(move |env, gc, args| {
638            let arguments = Arguments::new(args, env);
639            let arg_0 = wrap_in_language_error(arguments.get(0))?;
640            let arg_1 = wrap_in_language_error(arguments.get(1))?;
641            let arg_2 = wrap_in_language_error(arguments.get(2))?;
642
643            let result = self(arg_0, arg_1, arg_2);
644
645            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
646        })
647    }
648}
649
650impl<Fun, Ret, A, B, C> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C)>>
651    for Fun
652where
653    Fun: Fn(RawSelf<'_>, A, B, C) -> Ret + 'static,
654    Ret: IntoValue + 'static,
655    A: TryFromValue + 'static,
656    B: TryFromValue + 'static,
657    C: TryFromValue + 'static,
658{
659    type ParameterCount = MethodParameterCount;
660    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
661
662    fn into_raw_foreign_function(self) -> RawForeignFunction {
663        Box::new(move |env, gc, args| {
664            let arguments = Arguments::new(args, env);
665            let arg_self = RawSelf(arguments.raw_self());
666            let arg_0 = wrap_in_language_error(arguments.get(0))?;
667            let arg_1 = wrap_in_language_error(arguments.get(1))?;
668            let arg_2 = wrap_in_language_error(arguments.get(2))?;
669
670            let result = self(arg_self, arg_0, arg_1, arg_2);
671
672            Ok(result.into_value_with_environment(env).to_raw(gc))
673        })
674    }
675}
676
677impl<Fun, Ret, Err, A, B, C> ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C)>>
678    for Fun
679where
680    Fun: Fn(RawSelf<'_>, A, B, C) -> Result<Ret, Err> + 'static,
681    Ret: IntoValue + 'static,
682    Err: std::error::Error + 'static,
683    A: TryFromValue + 'static,
684    B: TryFromValue + 'static,
685    C: TryFromValue + 'static,
686{
687    type ParameterCount = MethodParameterCount;
688    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
689
690    fn into_raw_foreign_function(self) -> RawForeignFunction {
691        Box::new(move |env, gc, args| {
692            let arguments = Arguments::new(args, env);
693            let arg_self = RawSelf(arguments.raw_self());
694            let arg_0 = wrap_in_language_error(arguments.get(0))?;
695            let arg_1 = wrap_in_language_error(arguments.get(1))?;
696            let arg_2 = wrap_in_language_error(arguments.get(2))?;
697
698            let result = self(arg_self, arg_0, arg_1, arg_2);
699
700            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
701        })
702    }
703}
704
705impl<Fun, Ret, Recv, A, B, C>
706    ForeignFunction<ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C)>>
707    for Fun
708where
709    Fun: Fn(&Recv, A, B, C) -> Ret + 'static,
710    Ret: IntoValue + 'static,
711    Recv: SelfFromRawValue + 'static,
712    A: TryFromValue + 'static,
713    B: TryFromValue + 'static,
714    C: TryFromValue + 'static,
715{
716    type ParameterCount = MethodParameterCount;
717    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
718
719    fn into_raw_foreign_function(self) -> RawForeignFunction {
720        Box::new(move |env, gc, args| {
721            let arguments = Arguments::new(args, env);
722            let (arg_self, _guard) = wrap_in_language_error(unsafe {
723                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
724            })?;
725            let arg_0 = wrap_in_language_error(arguments.get(0))?;
726            let arg_1 = wrap_in_language_error(arguments.get(1))?;
727            let arg_2 = wrap_in_language_error(arguments.get(2))?;
728
729            let result = self(arg_self, arg_0, arg_1, arg_2);
730
731            Ok(result.into_value_with_environment(env).to_raw(gc))
732        })
733    }
734}
735
736impl<Fun, Ret, Recv, A, B, C>
737    ForeignFunction<ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C)>>
738    for Fun
739where
740    Fun: Fn(&mut Recv, A, B, C) -> Ret + 'static,
741    Ret: IntoValue + 'static,
742    Recv: MutSelfFromRawValue + 'static,
743    A: TryFromValue + 'static,
744    B: TryFromValue + 'static,
745    C: TryFromValue + 'static,
746{
747    type ParameterCount = MethodParameterCount;
748    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
749
750    fn into_raw_foreign_function(self) -> RawForeignFunction {
751        Box::new(move |env, gc, args| {
752            let arguments = Arguments::new(args, env);
753            let (arg_self, _guard) = wrap_in_language_error(unsafe {
754                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
755            })?;
756            let arg_0 = wrap_in_language_error(arguments.get(0))?;
757            let arg_1 = wrap_in_language_error(arguments.get(1))?;
758            let arg_2 = wrap_in_language_error(arguments.get(2))?;
759
760            let result = self(arg_self, arg_0, arg_1, arg_2);
761
762            Ok(result.into_value_with_environment(env).to_raw(gc))
763        })
764    }
765}
766
767impl<Fun, Ret, Err, Recv, A, B, C>
768    ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C)>>
769    for Fun
770where
771    Fun: Fn(&Recv, A, B, C) -> Result<Ret, Err> + 'static,
772    Ret: IntoValue + 'static,
773    Err: std::error::Error + 'static,
774    Recv: SelfFromRawValue + 'static,
775    A: TryFromValue + 'static,
776    B: TryFromValue + 'static,
777    C: TryFromValue + 'static,
778{
779    type ParameterCount = MethodParameterCount;
780    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
781
782    fn into_raw_foreign_function(self) -> RawForeignFunction {
783        Box::new(move |env, gc, args| {
784            let arguments = Arguments::new(args, env);
785            let (arg_self, _guard) = wrap_in_language_error(unsafe {
786                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
787            })?;
788            let arg_0 = wrap_in_language_error(arguments.get(0))?;
789            let arg_1 = wrap_in_language_error(arguments.get(1))?;
790            let arg_2 = wrap_in_language_error(arguments.get(2))?;
791
792            let result = self(arg_self, arg_0, arg_1, arg_2);
793
794            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
795        })
796    }
797}
798
799impl<Fun, Ret, Err, Recv, A, B, C>
800    ForeignFunction<ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C)>>
801    for Fun
802where
803    Fun: Fn(&mut Recv, A, B, C) -> Result<Ret, Err> + 'static,
804    Ret: IntoValue + 'static,
805    Err: std::error::Error + 'static,
806    Recv: MutSelfFromRawValue + 'static,
807    A: TryFromValue + 'static,
808    B: TryFromValue + 'static,
809    C: TryFromValue + 'static,
810{
811    type ParameterCount = MethodParameterCount;
812    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(4);
813
814    fn into_raw_foreign_function(self) -> RawForeignFunction {
815        Box::new(move |env, gc, args| {
816            let arguments = Arguments::new(args, env);
817            let (arg_self, _guard) = wrap_in_language_error(unsafe {
818                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
819            })?;
820            let arg_0 = wrap_in_language_error(arguments.get(0))?;
821            let arg_1 = wrap_in_language_error(arguments.get(1))?;
822            let arg_2 = wrap_in_language_error(arguments.get(2))?;
823
824            let result = self(arg_self, arg_0, arg_1, arg_2);
825
826            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
827        })
828    }
829}
830
831impl<Fun, Ret, A, B, C, D> ForeignFunction<ffvariants::Infallible<(A, B, C, D)>> for Fun
832where
833    Fun: Fn(A, B, C, D) -> Ret + 'static,
834    Ret: IntoValue + 'static,
835    A: TryFromValue + 'static,
836    B: TryFromValue + 'static,
837    C: TryFromValue + 'static,
838    D: TryFromValue + 'static,
839{
840    type ParameterCount = FunctionParameterCount;
841    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(4);
842
843    fn into_raw_foreign_function(self) -> RawForeignFunction {
844        Box::new(move |env, gc, args| {
845            let arguments = Arguments::new(args, env);
846            let arg_0 = wrap_in_language_error(arguments.get(0))?;
847            let arg_1 = wrap_in_language_error(arguments.get(1))?;
848            let arg_2 = wrap_in_language_error(arguments.get(2))?;
849            let arg_3 = wrap_in_language_error(arguments.get(3))?;
850
851            let result = self(arg_0, arg_1, arg_2, arg_3);
852
853            Ok(result.into_value_with_environment(env).to_raw(gc))
854        })
855    }
856}
857
858impl<Fun, Ret, Err, A, B, C, D> ForeignFunction<ffvariants::Fallible<(A, B, C, D)>> for Fun
859where
860    Fun: Fn(A, B, C, D) -> Result<Ret, Err> + 'static,
861    Ret: IntoValue + 'static,
862    Err: std::error::Error + 'static,
863    A: TryFromValue + 'static,
864    B: TryFromValue + 'static,
865    C: TryFromValue + 'static,
866    D: TryFromValue + 'static,
867{
868    type ParameterCount = FunctionParameterCount;
869    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(4);
870
871    fn into_raw_foreign_function(self) -> RawForeignFunction {
872        Box::new(move |env, gc, args| {
873            let arguments = Arguments::new(args, env);
874            let arg_0 = wrap_in_language_error(arguments.get(0))?;
875            let arg_1 = wrap_in_language_error(arguments.get(1))?;
876            let arg_2 = wrap_in_language_error(arguments.get(2))?;
877            let arg_3 = wrap_in_language_error(arguments.get(3))?;
878
879            let result = self(arg_0, arg_1, arg_2, arg_3);
880
881            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
882        })
883    }
884}
885
886impl<Fun, Ret, A, B, C, D> ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D)>>
887    for Fun
888where
889    Fun: Fn(RawSelf<'_>, A, B, C, D) -> Ret + 'static,
890    Ret: IntoValue + 'static,
891    A: TryFromValue + 'static,
892    B: TryFromValue + 'static,
893    C: TryFromValue + 'static,
894    D: TryFromValue + 'static,
895{
896    type ParameterCount = MethodParameterCount;
897    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
898
899    fn into_raw_foreign_function(self) -> RawForeignFunction {
900        Box::new(move |env, gc, args| {
901            let arguments = Arguments::new(args, env);
902            let arg_self = RawSelf(arguments.raw_self());
903            let arg_0 = wrap_in_language_error(arguments.get(0))?;
904            let arg_1 = wrap_in_language_error(arguments.get(1))?;
905            let arg_2 = wrap_in_language_error(arguments.get(2))?;
906            let arg_3 = wrap_in_language_error(arguments.get(3))?;
907
908            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
909
910            Ok(result.into_value_with_environment(env).to_raw(gc))
911        })
912    }
913}
914
915impl<Fun, Ret, Err, A, B, C, D>
916    ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D)>> for Fun
917where
918    Fun: Fn(RawSelf<'_>, A, B, C, D) -> Result<Ret, Err> + 'static,
919    Ret: IntoValue + 'static,
920    Err: std::error::Error + 'static,
921    A: TryFromValue + 'static,
922    B: TryFromValue + 'static,
923    C: TryFromValue + 'static,
924    D: TryFromValue + 'static,
925{
926    type ParameterCount = MethodParameterCount;
927    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
928
929    fn into_raw_foreign_function(self) -> RawForeignFunction {
930        Box::new(move |env, gc, args| {
931            let arguments = Arguments::new(args, env);
932            let arg_self = RawSelf(arguments.raw_self());
933            let arg_0 = wrap_in_language_error(arguments.get(0))?;
934            let arg_1 = wrap_in_language_error(arguments.get(1))?;
935            let arg_2 = wrap_in_language_error(arguments.get(2))?;
936            let arg_3 = wrap_in_language_error(arguments.get(3))?;
937
938            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
939
940            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
941        })
942    }
943}
944
945impl<Fun, Ret, Recv, A, B, C, D>
946    ForeignFunction<
947        ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D)>,
948    > for Fun
949where
950    Fun: Fn(&Recv, A, B, C, D) -> Ret + 'static,
951    Ret: IntoValue + 'static,
952    Recv: SelfFromRawValue + 'static,
953    A: TryFromValue + 'static,
954    B: TryFromValue + 'static,
955    C: TryFromValue + 'static,
956    D: TryFromValue + 'static,
957{
958    type ParameterCount = MethodParameterCount;
959    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
960
961    fn into_raw_foreign_function(self) -> RawForeignFunction {
962        Box::new(move |env, gc, args| {
963            let arguments = Arguments::new(args, env);
964            let (arg_self, _guard) = wrap_in_language_error(unsafe {
965                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
966            })?;
967            let arg_0 = wrap_in_language_error(arguments.get(0))?;
968            let arg_1 = wrap_in_language_error(arguments.get(1))?;
969            let arg_2 = wrap_in_language_error(arguments.get(2))?;
970            let arg_3 = wrap_in_language_error(arguments.get(3))?;
971
972            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
973
974            Ok(result.into_value_with_environment(env).to_raw(gc))
975        })
976    }
977}
978
979impl<Fun, Ret, Recv, A, B, C, D>
980    ForeignFunction<
981        ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D)>,
982    > for Fun
983where
984    Fun: Fn(&mut Recv, A, B, C, D) -> Ret + 'static,
985    Ret: IntoValue + 'static,
986    Recv: MutSelfFromRawValue + 'static,
987    A: TryFromValue + 'static,
988    B: TryFromValue + 'static,
989    C: TryFromValue + 'static,
990    D: TryFromValue + 'static,
991{
992    type ParameterCount = MethodParameterCount;
993    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
994
995    fn into_raw_foreign_function(self) -> RawForeignFunction {
996        Box::new(move |env, gc, args| {
997            let arguments = Arguments::new(args, env);
998            let (arg_self, _guard) = wrap_in_language_error(unsafe {
999                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
1000            })?;
1001            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1002            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1003            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1004            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1005
1006            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
1007
1008            Ok(result.into_value_with_environment(env).to_raw(gc))
1009        })
1010    }
1011}
1012
1013impl<Fun, Ret, Err, Recv, A, B, C, D>
1014    ForeignFunction<ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D)>>
1015    for Fun
1016where
1017    Fun: Fn(&Recv, A, B, C, D) -> Result<Ret, Err> + 'static,
1018    Ret: IntoValue + 'static,
1019    Err: std::error::Error + 'static,
1020    Recv: SelfFromRawValue + 'static,
1021    A: TryFromValue + 'static,
1022    B: TryFromValue + 'static,
1023    C: TryFromValue + 'static,
1024    D: TryFromValue + 'static,
1025{
1026    type ParameterCount = MethodParameterCount;
1027    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
1028
1029    fn into_raw_foreign_function(self) -> RawForeignFunction {
1030        Box::new(move |env, gc, args| {
1031            let arguments = Arguments::new(args, env);
1032            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1033                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
1034            })?;
1035            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1036            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1037            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1038            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1039
1040            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
1041
1042            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1043        })
1044    }
1045}
1046
1047impl<Fun, Ret, Err, Recv, A, B, C, D>
1048    ForeignFunction<
1049        ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D)>,
1050    > for Fun
1051where
1052    Fun: Fn(&mut Recv, A, B, C, D) -> Result<Ret, Err> + 'static,
1053    Ret: IntoValue + 'static,
1054    Err: std::error::Error + 'static,
1055    Recv: MutSelfFromRawValue + 'static,
1056    A: TryFromValue + 'static,
1057    B: TryFromValue + 'static,
1058    C: TryFromValue + 'static,
1059    D: TryFromValue + 'static,
1060{
1061    type ParameterCount = MethodParameterCount;
1062    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(5);
1063
1064    fn into_raw_foreign_function(self) -> RawForeignFunction {
1065        Box::new(move |env, gc, args| {
1066            let arguments = Arguments::new(args, env);
1067            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1068                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
1069            })?;
1070            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1071            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1072            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1073            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1074
1075            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3);
1076
1077            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1078        })
1079    }
1080}
1081
1082impl<Fun, Ret, A, B, C, D, E> ForeignFunction<ffvariants::Infallible<(A, B, C, D, E)>> for Fun
1083where
1084    Fun: Fn(A, B, C, D, E) -> Ret + 'static,
1085    Ret: IntoValue + 'static,
1086    A: TryFromValue + 'static,
1087    B: TryFromValue + 'static,
1088    C: TryFromValue + 'static,
1089    D: TryFromValue + 'static,
1090    E: TryFromValue + 'static,
1091{
1092    type ParameterCount = FunctionParameterCount;
1093    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(5);
1094
1095    fn into_raw_foreign_function(self) -> RawForeignFunction {
1096        Box::new(move |env, gc, args| {
1097            let arguments = Arguments::new(args, env);
1098            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1099            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1100            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1101            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1102            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1103
1104            let result = self(arg_0, arg_1, arg_2, arg_3, arg_4);
1105
1106            Ok(result.into_value_with_environment(env).to_raw(gc))
1107        })
1108    }
1109}
1110
1111impl<Fun, Ret, Err, A, B, C, D, E> ForeignFunction<ffvariants::Fallible<(A, B, C, D, E)>> for Fun
1112where
1113    Fun: Fn(A, B, C, D, E) -> Result<Ret, Err> + 'static,
1114    Ret: IntoValue + 'static,
1115    Err: std::error::Error + 'static,
1116    A: TryFromValue + 'static,
1117    B: TryFromValue + 'static,
1118    C: TryFromValue + 'static,
1119    D: TryFromValue + 'static,
1120    E: TryFromValue + 'static,
1121{
1122    type ParameterCount = FunctionParameterCount;
1123    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(5);
1124
1125    fn into_raw_foreign_function(self) -> RawForeignFunction {
1126        Box::new(move |env, gc, args| {
1127            let arguments = Arguments::new(args, env);
1128            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1129            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1130            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1131            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1132            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1133
1134            let result = self(arg_0, arg_1, arg_2, arg_3, arg_4);
1135
1136            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1137        })
1138    }
1139}
1140
1141impl<Fun, Ret, A, B, C, D, E>
1142    ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D, E)>> for Fun
1143where
1144    Fun: Fn(RawSelf<'_>, A, B, C, D, E) -> Ret + 'static,
1145    Ret: IntoValue + 'static,
1146    A: TryFromValue + 'static,
1147    B: TryFromValue + 'static,
1148    C: TryFromValue + 'static,
1149    D: TryFromValue + 'static,
1150    E: TryFromValue + 'static,
1151{
1152    type ParameterCount = MethodParameterCount;
1153    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
1154
1155    fn into_raw_foreign_function(self) -> RawForeignFunction {
1156        Box::new(move |env, gc, args| {
1157            let arguments = Arguments::new(args, env);
1158            let arg_self = RawSelf(arguments.raw_self());
1159            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1160            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1161            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1162            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1163            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1164
1165            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
1166
1167            Ok(result.into_value_with_environment(env).to_raw(gc))
1168        })
1169    }
1170}
1171
1172impl<Fun, Ret, Err, A, B, C, D, E>
1173    ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D, E)>> for Fun
1174where
1175    Fun: Fn(RawSelf<'_>, A, B, C, D, E) -> Result<Ret, Err> + 'static,
1176    Ret: IntoValue + 'static,
1177    Err: std::error::Error + 'static,
1178    A: TryFromValue + 'static,
1179    B: TryFromValue + 'static,
1180    C: TryFromValue + 'static,
1181    D: TryFromValue + 'static,
1182    E: TryFromValue + 'static,
1183{
1184    type ParameterCount = MethodParameterCount;
1185    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
1186
1187    fn into_raw_foreign_function(self) -> RawForeignFunction {
1188        Box::new(move |env, gc, args| {
1189            let arguments = Arguments::new(args, env);
1190            let arg_self = RawSelf(arguments.raw_self());
1191            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1192            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1193            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1194            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1195            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1196
1197            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
1198
1199            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1200        })
1201    }
1202}
1203
1204impl<Fun, Ret, Recv, A, B, C, D, E>
1205    ForeignFunction<
1206        ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E)>,
1207    > for Fun
1208where
1209    Fun: Fn(&Recv, A, B, C, D, E) -> Ret + 'static,
1210    Ret: IntoValue + 'static,
1211    Recv: SelfFromRawValue + 'static,
1212    A: TryFromValue + 'static,
1213    B: TryFromValue + 'static,
1214    C: TryFromValue + 'static,
1215    D: TryFromValue + 'static,
1216    E: TryFromValue + 'static,
1217{
1218    type ParameterCount = MethodParameterCount;
1219    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
1220
1221    fn into_raw_foreign_function(self) -> RawForeignFunction {
1222        Box::new(move |env, gc, args| {
1223            let arguments = Arguments::new(args, env);
1224            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1225                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
1226            })?;
1227            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1228            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1229            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1230            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1231            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1232
1233            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
1234
1235            Ok(result.into_value_with_environment(env).to_raw(gc))
1236        })
1237    }
1238}
1239
1240impl<Fun, Ret, Recv, A, B, C, D, E>
1241    ForeignFunction<
1242        ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E)>,
1243    > for Fun
1244where
1245    Fun: Fn(&mut Recv, A, B, C, D, E) -> Ret + 'static,
1246    Ret: IntoValue + 'static,
1247    Recv: MutSelfFromRawValue + 'static,
1248    A: TryFromValue + 'static,
1249    B: TryFromValue + 'static,
1250    C: TryFromValue + 'static,
1251    D: TryFromValue + 'static,
1252    E: TryFromValue + 'static,
1253{
1254    type ParameterCount = MethodParameterCount;
1255    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
1256
1257    fn into_raw_foreign_function(self) -> RawForeignFunction {
1258        Box::new(move |env, gc, args| {
1259            let arguments = Arguments::new(args, env);
1260            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1261                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
1262            })?;
1263            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1264            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1265            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1266            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1267            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1268
1269            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
1270
1271            Ok(result.into_value_with_environment(env).to_raw(gc))
1272        })
1273    }
1274}
1275
1276impl<Fun, Ret, Err, Recv, A, B, C, D, E>
1277    ForeignFunction<
1278        ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E)>,
1279    > for Fun
1280where
1281    Fun: Fn(&Recv, A, B, C, D, E) -> Result<Ret, Err> + 'static,
1282    Ret: IntoValue + 'static,
1283    Err: std::error::Error + 'static,
1284    Recv: SelfFromRawValue + 'static,
1285    A: TryFromValue + 'static,
1286    B: TryFromValue + 'static,
1287    C: TryFromValue + 'static,
1288    D: TryFromValue + 'static,
1289    E: TryFromValue + 'static,
1290{
1291    type ParameterCount = MethodParameterCount;
1292    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
1293
1294    fn into_raw_foreign_function(self) -> RawForeignFunction {
1295        Box::new(move |env, gc, args| {
1296            let arguments = Arguments::new(args, env);
1297            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1298                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
1299            })?;
1300            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1301            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1302            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1303            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1304            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1305
1306            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
1307
1308            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1309        })
1310    }
1311}
1312
1313impl<Fun, Ret, Err, Recv, A, B, C, D, E>
1314    ForeignFunction<
1315        ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E)>,
1316    > for Fun
1317where
1318    Fun: Fn(&mut Recv, A, B, C, D, E) -> Result<Ret, Err> + 'static,
1319    Ret: IntoValue + 'static,
1320    Err: std::error::Error + 'static,
1321    Recv: MutSelfFromRawValue + 'static,
1322    A: TryFromValue + 'static,
1323    B: TryFromValue + 'static,
1324    C: TryFromValue + 'static,
1325    D: TryFromValue + 'static,
1326    E: TryFromValue + 'static,
1327{
1328    type ParameterCount = MethodParameterCount;
1329    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(6);
1330
1331    fn into_raw_foreign_function(self) -> RawForeignFunction {
1332        Box::new(move |env, gc, args| {
1333            let arguments = Arguments::new(args, env);
1334            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1335                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
1336            })?;
1337            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1338            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1339            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1340            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1341            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1342
1343            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4);
1344
1345            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1346        })
1347    }
1348}
1349
1350impl<Fun, Ret, A, B, C, D, E, F> ForeignFunction<ffvariants::Infallible<(A, B, C, D, E, F)>> for Fun
1351where
1352    Fun: Fn(A, B, C, D, E, F) -> Ret + 'static,
1353    Ret: IntoValue + 'static,
1354    A: TryFromValue + 'static,
1355    B: TryFromValue + 'static,
1356    C: TryFromValue + 'static,
1357    D: TryFromValue + 'static,
1358    E: TryFromValue + 'static,
1359    F: TryFromValue + 'static,
1360{
1361    type ParameterCount = FunctionParameterCount;
1362    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(6);
1363
1364    fn into_raw_foreign_function(self) -> RawForeignFunction {
1365        Box::new(move |env, gc, args| {
1366            let arguments = Arguments::new(args, env);
1367            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1368            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1369            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1370            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1371            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1372            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1373
1374            let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
1375
1376            Ok(result.into_value_with_environment(env).to_raw(gc))
1377        })
1378    }
1379}
1380
1381impl<Fun, Ret, Err, A, B, C, D, E, F> ForeignFunction<ffvariants::Fallible<(A, B, C, D, E, F)>>
1382    for Fun
1383where
1384    Fun: Fn(A, B, C, D, E, F) -> Result<Ret, Err> + 'static,
1385    Ret: IntoValue + 'static,
1386    Err: std::error::Error + 'static,
1387    A: TryFromValue + 'static,
1388    B: TryFromValue + 'static,
1389    C: TryFromValue + 'static,
1390    D: TryFromValue + 'static,
1391    E: TryFromValue + 'static,
1392    F: TryFromValue + 'static,
1393{
1394    type ParameterCount = FunctionParameterCount;
1395    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(6);
1396
1397    fn into_raw_foreign_function(self) -> RawForeignFunction {
1398        Box::new(move |env, gc, args| {
1399            let arguments = Arguments::new(args, env);
1400            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1401            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1402            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1403            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1404            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1405            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1406
1407            let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
1408
1409            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1410        })
1411    }
1412}
1413
1414impl<Fun, Ret, A, B, C, D, E, F>
1415    ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F)>> for Fun
1416where
1417    Fun: Fn(RawSelf<'_>, A, B, C, D, E, F) -> Ret + 'static,
1418    Ret: IntoValue + 'static,
1419    A: TryFromValue + 'static,
1420    B: TryFromValue + 'static,
1421    C: TryFromValue + 'static,
1422    D: TryFromValue + 'static,
1423    E: TryFromValue + 'static,
1424    F: TryFromValue + 'static,
1425{
1426    type ParameterCount = MethodParameterCount;
1427    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
1428
1429    fn into_raw_foreign_function(self) -> RawForeignFunction {
1430        Box::new(move |env, gc, args| {
1431            let arguments = Arguments::new(args, env);
1432            let arg_self = RawSelf(arguments.raw_self());
1433            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1434            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1435            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1436            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1437            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1438            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1439
1440            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
1441
1442            Ok(result.into_value_with_environment(env).to_raw(gc))
1443        })
1444    }
1445}
1446
1447impl<Fun, Ret, Err, A, B, C, D, E, F>
1448    ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F)>> for Fun
1449where
1450    Fun: Fn(RawSelf<'_>, A, B, C, D, E, F) -> Result<Ret, Err> + 'static,
1451    Ret: IntoValue + 'static,
1452    Err: std::error::Error + 'static,
1453    A: TryFromValue + 'static,
1454    B: TryFromValue + 'static,
1455    C: TryFromValue + 'static,
1456    D: TryFromValue + 'static,
1457    E: TryFromValue + 'static,
1458    F: TryFromValue + 'static,
1459{
1460    type ParameterCount = MethodParameterCount;
1461    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
1462
1463    fn into_raw_foreign_function(self) -> RawForeignFunction {
1464        Box::new(move |env, gc, args| {
1465            let arguments = Arguments::new(args, env);
1466            let arg_self = RawSelf(arguments.raw_self());
1467            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1468            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1469            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1470            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1471            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1472            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1473
1474            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
1475
1476            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1477        })
1478    }
1479}
1480
1481impl<Fun, Ret, Recv, A, B, C, D, E, F>
1482    ForeignFunction<
1483        ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F)>,
1484    > for Fun
1485where
1486    Fun: Fn(&Recv, A, B, C, D, E, F) -> Ret + 'static,
1487    Ret: IntoValue + 'static,
1488    Recv: SelfFromRawValue + 'static,
1489    A: TryFromValue + 'static,
1490    B: TryFromValue + 'static,
1491    C: TryFromValue + 'static,
1492    D: TryFromValue + 'static,
1493    E: TryFromValue + 'static,
1494    F: TryFromValue + 'static,
1495{
1496    type ParameterCount = MethodParameterCount;
1497    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
1498
1499    fn into_raw_foreign_function(self) -> RawForeignFunction {
1500        Box::new(move |env, gc, args| {
1501            let arguments = Arguments::new(args, env);
1502            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1503                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
1504            })?;
1505            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1506            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1507            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1508            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1509            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1510            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1511
1512            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
1513
1514            Ok(result.into_value_with_environment(env).to_raw(gc))
1515        })
1516    }
1517}
1518
1519impl<Fun, Ret, Recv, A, B, C, D, E, F>
1520    ForeignFunction<
1521        ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E, F)>,
1522    > for Fun
1523where
1524    Fun: Fn(&mut Recv, A, B, C, D, E, F) -> Ret + 'static,
1525    Ret: IntoValue + 'static,
1526    Recv: MutSelfFromRawValue + 'static,
1527    A: TryFromValue + 'static,
1528    B: TryFromValue + 'static,
1529    C: TryFromValue + 'static,
1530    D: TryFromValue + 'static,
1531    E: TryFromValue + 'static,
1532    F: TryFromValue + 'static,
1533{
1534    type ParameterCount = MethodParameterCount;
1535    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
1536
1537    fn into_raw_foreign_function(self) -> RawForeignFunction {
1538        Box::new(move |env, gc, args| {
1539            let arguments = Arguments::new(args, env);
1540            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1541                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
1542            })?;
1543            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1544            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1545            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1546            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1547            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1548            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1549
1550            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
1551
1552            Ok(result.into_value_with_environment(env).to_raw(gc))
1553        })
1554    }
1555}
1556
1557impl<Fun, Ret, Err, Recv, A, B, C, D, E, F>
1558    ForeignFunction<
1559        ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F)>,
1560    > for Fun
1561where
1562    Fun: Fn(&Recv, A, B, C, D, E, F) -> Result<Ret, Err> + 'static,
1563    Ret: IntoValue + 'static,
1564    Err: std::error::Error + 'static,
1565    Recv: SelfFromRawValue + 'static,
1566    A: TryFromValue + 'static,
1567    B: TryFromValue + 'static,
1568    C: TryFromValue + 'static,
1569    D: TryFromValue + 'static,
1570    E: TryFromValue + 'static,
1571    F: TryFromValue + 'static,
1572{
1573    type ParameterCount = MethodParameterCount;
1574    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
1575
1576    fn into_raw_foreign_function(self) -> RawForeignFunction {
1577        Box::new(move |env, gc, args| {
1578            let arguments = Arguments::new(args, env);
1579            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1580                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
1581            })?;
1582            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1583            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1584            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1585            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1586            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1587            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1588
1589            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
1590
1591            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1592        })
1593    }
1594}
1595
1596impl<Fun, Ret, Err, Recv, A, B, C, D, E, F>
1597    ForeignFunction<
1598        ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E, F)>,
1599    > for Fun
1600where
1601    Fun: Fn(&mut Recv, A, B, C, D, E, F) -> Result<Ret, Err> + 'static,
1602    Ret: IntoValue + 'static,
1603    Err: std::error::Error + 'static,
1604    Recv: MutSelfFromRawValue + 'static,
1605    A: TryFromValue + 'static,
1606    B: TryFromValue + 'static,
1607    C: TryFromValue + 'static,
1608    D: TryFromValue + 'static,
1609    E: TryFromValue + 'static,
1610    F: TryFromValue + 'static,
1611{
1612    type ParameterCount = MethodParameterCount;
1613    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(7);
1614
1615    fn into_raw_foreign_function(self) -> RawForeignFunction {
1616        Box::new(move |env, gc, args| {
1617            let arguments = Arguments::new(args, env);
1618            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1619                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
1620            })?;
1621            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1622            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1623            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1624            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1625            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1626            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1627
1628            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5);
1629
1630            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1631        })
1632    }
1633}
1634
1635impl<Fun, Ret, A, B, C, D, E, F, G> ForeignFunction<ffvariants::Infallible<(A, B, C, D, E, F, G)>>
1636    for Fun
1637where
1638    Fun: Fn(A, B, C, D, E, F, G) -> Ret + 'static,
1639    Ret: IntoValue + 'static,
1640    A: TryFromValue + 'static,
1641    B: TryFromValue + 'static,
1642    C: TryFromValue + 'static,
1643    D: TryFromValue + 'static,
1644    E: TryFromValue + 'static,
1645    F: TryFromValue + 'static,
1646    G: TryFromValue + 'static,
1647{
1648    type ParameterCount = FunctionParameterCount;
1649    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(7);
1650
1651    fn into_raw_foreign_function(self) -> RawForeignFunction {
1652        Box::new(move |env, gc, args| {
1653            let arguments = Arguments::new(args, env);
1654            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1655            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1656            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1657            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1658            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1659            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1660            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1661
1662            let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
1663
1664            Ok(result.into_value_with_environment(env).to_raw(gc))
1665        })
1666    }
1667}
1668
1669impl<Fun, Ret, Err, A, B, C, D, E, F, G>
1670    ForeignFunction<ffvariants::Fallible<(A, B, C, D, E, F, G)>> for Fun
1671where
1672    Fun: Fn(A, B, C, D, E, F, G) -> Result<Ret, Err> + 'static,
1673    Ret: IntoValue + 'static,
1674    Err: std::error::Error + 'static,
1675    A: TryFromValue + 'static,
1676    B: TryFromValue + 'static,
1677    C: TryFromValue + 'static,
1678    D: TryFromValue + 'static,
1679    E: TryFromValue + 'static,
1680    F: TryFromValue + 'static,
1681    G: TryFromValue + 'static,
1682{
1683    type ParameterCount = FunctionParameterCount;
1684    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(7);
1685
1686    fn into_raw_foreign_function(self) -> RawForeignFunction {
1687        Box::new(move |env, gc, args| {
1688            let arguments = Arguments::new(args, env);
1689            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1690            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1691            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1692            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1693            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1694            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1695            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1696
1697            let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
1698
1699            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1700        })
1701    }
1702}
1703
1704impl<Fun, Ret, A, B, C, D, E, F, G>
1705    ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F, G)>> for Fun
1706where
1707    Fun: Fn(RawSelf<'_>, A, B, C, D, E, F, G) -> Ret + 'static,
1708    Ret: IntoValue + 'static,
1709    A: TryFromValue + 'static,
1710    B: TryFromValue + 'static,
1711    C: TryFromValue + 'static,
1712    D: TryFromValue + 'static,
1713    E: TryFromValue + 'static,
1714    F: TryFromValue + 'static,
1715    G: TryFromValue + 'static,
1716{
1717    type ParameterCount = MethodParameterCount;
1718    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
1719
1720    fn into_raw_foreign_function(self) -> RawForeignFunction {
1721        Box::new(move |env, gc, args| {
1722            let arguments = Arguments::new(args, env);
1723            let arg_self = RawSelf(arguments.raw_self());
1724            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1725            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1726            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1727            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1728            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1729            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1730            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1731
1732            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
1733
1734            Ok(result.into_value_with_environment(env).to_raw(gc))
1735        })
1736    }
1737}
1738
1739impl<Fun, Ret, Err, A, B, C, D, E, F, G>
1740    ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F, G)>> for Fun
1741where
1742    Fun: Fn(RawSelf<'_>, A, B, C, D, E, F, G) -> Result<Ret, Err> + 'static,
1743    Ret: IntoValue + 'static,
1744    Err: std::error::Error + 'static,
1745    A: TryFromValue + 'static,
1746    B: TryFromValue + 'static,
1747    C: TryFromValue + 'static,
1748    D: TryFromValue + 'static,
1749    E: TryFromValue + 'static,
1750    F: TryFromValue + 'static,
1751    G: TryFromValue + 'static,
1752{
1753    type ParameterCount = MethodParameterCount;
1754    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
1755
1756    fn into_raw_foreign_function(self) -> RawForeignFunction {
1757        Box::new(move |env, gc, args| {
1758            let arguments = Arguments::new(args, env);
1759            let arg_self = RawSelf(arguments.raw_self());
1760            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1761            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1762            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1763            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1764            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1765            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1766            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1767
1768            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
1769
1770            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1771        })
1772    }
1773}
1774
1775impl<Fun, Ret, Recv, A, B, C, D, E, F, G>
1776    ForeignFunction<
1777        ffvariants::InfallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F, G)>,
1778    > for Fun
1779where
1780    Fun: Fn(&Recv, A, B, C, D, E, F, G) -> Ret + 'static,
1781    Ret: IntoValue + 'static,
1782    Recv: SelfFromRawValue + 'static,
1783    A: TryFromValue + 'static,
1784    B: TryFromValue + 'static,
1785    C: TryFromValue + 'static,
1786    D: TryFromValue + 'static,
1787    E: TryFromValue + 'static,
1788    F: TryFromValue + 'static,
1789    G: TryFromValue + 'static,
1790{
1791    type ParameterCount = MethodParameterCount;
1792    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
1793
1794    fn into_raw_foreign_function(self) -> RawForeignFunction {
1795        Box::new(move |env, gc, args| {
1796            let arguments = Arguments::new(args, env);
1797            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1798                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
1799            })?;
1800            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1801            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1802            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1803            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1804            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1805            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1806            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1807
1808            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
1809
1810            Ok(result.into_value_with_environment(env).to_raw(gc))
1811        })
1812    }
1813}
1814
1815impl<Fun, Ret, Recv, A, B, C, D, E, F, G>
1816    ForeignFunction<
1817        ffvariants::InfallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E, F, G)>,
1818    > for Fun
1819where
1820    Fun: Fn(&mut Recv, A, B, C, D, E, F, G) -> Ret + 'static,
1821    Ret: IntoValue + 'static,
1822    Recv: MutSelfFromRawValue + 'static,
1823    A: TryFromValue + 'static,
1824    B: TryFromValue + 'static,
1825    C: TryFromValue + 'static,
1826    D: TryFromValue + 'static,
1827    E: TryFromValue + 'static,
1828    F: TryFromValue + 'static,
1829    G: TryFromValue + 'static,
1830{
1831    type ParameterCount = MethodParameterCount;
1832    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
1833
1834    fn into_raw_foreign_function(self) -> RawForeignFunction {
1835        Box::new(move |env, gc, args| {
1836            let arguments = Arguments::new(args, env);
1837            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1838                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
1839            })?;
1840            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1841            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1842            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1843            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1844            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1845            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1846            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1847
1848            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
1849
1850            Ok(result.into_value_with_environment(env).to_raw(gc))
1851        })
1852    }
1853}
1854
1855impl<Fun, Ret, Err, Recv, A, B, C, D, E, F, G>
1856    ForeignFunction<
1857        ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F, G)>,
1858    > for Fun
1859where
1860    Fun: Fn(&Recv, A, B, C, D, E, F, G) -> Result<Ret, Err> + 'static,
1861    Ret: IntoValue + 'static,
1862    Err: std::error::Error + 'static,
1863    Recv: SelfFromRawValue + 'static,
1864    A: TryFromValue + 'static,
1865    B: TryFromValue + 'static,
1866    C: TryFromValue + 'static,
1867    D: TryFromValue + 'static,
1868    E: TryFromValue + 'static,
1869    F: TryFromValue + 'static,
1870    G: TryFromValue + 'static,
1871{
1872    type ParameterCount = MethodParameterCount;
1873    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
1874
1875    fn into_raw_foreign_function(self) -> RawForeignFunction {
1876        Box::new(move |env, gc, args| {
1877            let arguments = Arguments::new(args, env);
1878            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1879                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
1880            })?;
1881            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1882            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1883            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1884            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1885            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1886            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1887            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1888
1889            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
1890
1891            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1892        })
1893    }
1894}
1895
1896impl<Fun, Ret, Err, Recv, A, B, C, D, E, F, G>
1897    ForeignFunction<
1898        ffvariants::FallibleSelf<ffvariants::MutableSelf<Recv>, (&mut Recv, A, B, C, D, E, F, G)>,
1899    > for Fun
1900where
1901    Fun: Fn(&mut Recv, A, B, C, D, E, F, G) -> Result<Ret, Err> + 'static,
1902    Ret: IntoValue + 'static,
1903    Err: std::error::Error + 'static,
1904    Recv: MutSelfFromRawValue + 'static,
1905    A: TryFromValue + 'static,
1906    B: TryFromValue + 'static,
1907    C: TryFromValue + 'static,
1908    D: TryFromValue + 'static,
1909    E: TryFromValue + 'static,
1910    F: TryFromValue + 'static,
1911    G: TryFromValue + 'static,
1912{
1913    type ParameterCount = MethodParameterCount;
1914    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(8);
1915
1916    fn into_raw_foreign_function(self) -> RawForeignFunction {
1917        Box::new(move |env, gc, args| {
1918            let arguments = Arguments::new(args, env);
1919            let (arg_self, _guard) = wrap_in_language_error(unsafe {
1920                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
1921            })?;
1922            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1923            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1924            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1925            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1926            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1927            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1928            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1929
1930            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
1931
1932            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
1933        })
1934    }
1935}
1936
1937impl<Fun, Ret, A, B, C, D, E, F, G, H>
1938    ForeignFunction<ffvariants::Infallible<(A, B, C, D, E, F, G, H)>> for Fun
1939where
1940    Fun: Fn(A, B, C, D, E, F, G, H) -> Ret + 'static,
1941    Ret: IntoValue + 'static,
1942    A: TryFromValue + 'static,
1943    B: TryFromValue + 'static,
1944    C: TryFromValue + 'static,
1945    D: TryFromValue + 'static,
1946    E: TryFromValue + 'static,
1947    F: TryFromValue + 'static,
1948    G: TryFromValue + 'static,
1949    H: TryFromValue + 'static,
1950{
1951    type ParameterCount = FunctionParameterCount;
1952    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(8);
1953
1954    fn into_raw_foreign_function(self) -> RawForeignFunction {
1955        Box::new(move |env, gc, args| {
1956            let arguments = Arguments::new(args, env);
1957            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1958            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1959            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1960            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1961            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1962            let arg_5 = wrap_in_language_error(arguments.get(5))?;
1963            let arg_6 = wrap_in_language_error(arguments.get(6))?;
1964            let arg_7 = wrap_in_language_error(arguments.get(7))?;
1965
1966            let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
1967
1968            Ok(result.into_value_with_environment(env).to_raw(gc))
1969        })
1970    }
1971}
1972
1973impl<Fun, Ret, Err, A, B, C, D, E, F, G, H>
1974    ForeignFunction<ffvariants::Fallible<(A, B, C, D, E, F, G, H)>> for Fun
1975where
1976    Fun: Fn(A, B, C, D, E, F, G, H) -> Result<Ret, Err> + 'static,
1977    Ret: IntoValue + 'static,
1978    Err: std::error::Error + 'static,
1979    A: TryFromValue + 'static,
1980    B: TryFromValue + 'static,
1981    C: TryFromValue + 'static,
1982    D: TryFromValue + 'static,
1983    E: TryFromValue + 'static,
1984    F: TryFromValue + 'static,
1985    G: TryFromValue + 'static,
1986    H: TryFromValue + 'static,
1987{
1988    type ParameterCount = FunctionParameterCount;
1989    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::Fixed(8);
1990
1991    fn into_raw_foreign_function(self) -> RawForeignFunction {
1992        Box::new(move |env, gc, args| {
1993            let arguments = Arguments::new(args, env);
1994            let arg_0 = wrap_in_language_error(arguments.get(0))?;
1995            let arg_1 = wrap_in_language_error(arguments.get(1))?;
1996            let arg_2 = wrap_in_language_error(arguments.get(2))?;
1997            let arg_3 = wrap_in_language_error(arguments.get(3))?;
1998            let arg_4 = wrap_in_language_error(arguments.get(4))?;
1999            let arg_5 = wrap_in_language_error(arguments.get(5))?;
2000            let arg_6 = wrap_in_language_error(arguments.get(6))?;
2001            let arg_7 = wrap_in_language_error(arguments.get(7))?;
2002
2003            let result = self(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
2004
2005            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
2006        })
2007    }
2008}
2009
2010impl<Fun, Ret, A, B, C, D, E, F, G, H>
2011    ForeignFunction<ffvariants::InfallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F, G, H)>> for Fun
2012where
2013    Fun: Fn(RawSelf<'_>, A, B, C, D, E, F, G, H) -> Ret + 'static,
2014    Ret: IntoValue + 'static,
2015    A: TryFromValue + 'static,
2016    B: TryFromValue + 'static,
2017    C: TryFromValue + 'static,
2018    D: TryFromValue + 'static,
2019    E: TryFromValue + 'static,
2020    F: TryFromValue + 'static,
2021    G: TryFromValue + 'static,
2022    H: TryFromValue + 'static,
2023{
2024    type ParameterCount = MethodParameterCount;
2025    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
2026
2027    fn into_raw_foreign_function(self) -> RawForeignFunction {
2028        Box::new(move |env, gc, args| {
2029            let arguments = Arguments::new(args, env);
2030            let arg_self = RawSelf(arguments.raw_self());
2031            let arg_0 = wrap_in_language_error(arguments.get(0))?;
2032            let arg_1 = wrap_in_language_error(arguments.get(1))?;
2033            let arg_2 = wrap_in_language_error(arguments.get(2))?;
2034            let arg_3 = wrap_in_language_error(arguments.get(3))?;
2035            let arg_4 = wrap_in_language_error(arguments.get(4))?;
2036            let arg_5 = wrap_in_language_error(arguments.get(5))?;
2037            let arg_6 = wrap_in_language_error(arguments.get(6))?;
2038            let arg_7 = wrap_in_language_error(arguments.get(7))?;
2039
2040            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
2041
2042            Ok(result.into_value_with_environment(env).to_raw(gc))
2043        })
2044    }
2045}
2046
2047impl<Fun, Ret, Err, A, B, C, D, E, F, G, H>
2048    ForeignFunction<ffvariants::FallibleRawSelf<(RawSelf<'_>, A, B, C, D, E, F, G, H)>> for Fun
2049where
2050    Fun: Fn(RawSelf<'_>, A, B, C, D, E, F, G, H) -> Result<Ret, Err> + 'static,
2051    Ret: IntoValue + 'static,
2052    Err: std::error::Error + 'static,
2053    A: TryFromValue + 'static,
2054    B: TryFromValue + 'static,
2055    C: TryFromValue + 'static,
2056    D: TryFromValue + 'static,
2057    E: TryFromValue + 'static,
2058    F: TryFromValue + 'static,
2059    G: TryFromValue + 'static,
2060    H: TryFromValue + 'static,
2061{
2062    type ParameterCount = MethodParameterCount;
2063    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
2064
2065    fn into_raw_foreign_function(self) -> RawForeignFunction {
2066        Box::new(move |env, gc, args| {
2067            let arguments = Arguments::new(args, env);
2068            let arg_self = RawSelf(arguments.raw_self());
2069            let arg_0 = wrap_in_language_error(arguments.get(0))?;
2070            let arg_1 = wrap_in_language_error(arguments.get(1))?;
2071            let arg_2 = wrap_in_language_error(arguments.get(2))?;
2072            let arg_3 = wrap_in_language_error(arguments.get(3))?;
2073            let arg_4 = wrap_in_language_error(arguments.get(4))?;
2074            let arg_5 = wrap_in_language_error(arguments.get(5))?;
2075            let arg_6 = wrap_in_language_error(arguments.get(6))?;
2076            let arg_7 = wrap_in_language_error(arguments.get(7))?;
2077
2078            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
2079
2080            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
2081        })
2082    }
2083}
2084
2085impl<Fun, Ret, Recv, A, B, C, D, E, F, G, H>
2086    ForeignFunction<
2087        ffvariants::InfallibleSelf<
2088            ffvariants::ImmutableSelf<Recv>,
2089            (&Recv, A, B, C, D, E, F, G, H),
2090        >,
2091    > for Fun
2092where
2093    Fun: Fn(&Recv, A, B, C, D, E, F, G, H) -> Ret + 'static,
2094    Ret: IntoValue + 'static,
2095    Recv: SelfFromRawValue + 'static,
2096    A: TryFromValue + 'static,
2097    B: TryFromValue + 'static,
2098    C: TryFromValue + 'static,
2099    D: TryFromValue + 'static,
2100    E: TryFromValue + 'static,
2101    F: TryFromValue + 'static,
2102    G: TryFromValue + 'static,
2103    H: TryFromValue + 'static,
2104{
2105    type ParameterCount = MethodParameterCount;
2106    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
2107
2108    fn into_raw_foreign_function(self) -> RawForeignFunction {
2109        Box::new(move |env, gc, args| {
2110            let arguments = Arguments::new(args, env);
2111            let (arg_self, _guard) = wrap_in_language_error(unsafe {
2112                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
2113            })?;
2114            let arg_0 = wrap_in_language_error(arguments.get(0))?;
2115            let arg_1 = wrap_in_language_error(arguments.get(1))?;
2116            let arg_2 = wrap_in_language_error(arguments.get(2))?;
2117            let arg_3 = wrap_in_language_error(arguments.get(3))?;
2118            let arg_4 = wrap_in_language_error(arguments.get(4))?;
2119            let arg_5 = wrap_in_language_error(arguments.get(5))?;
2120            let arg_6 = wrap_in_language_error(arguments.get(6))?;
2121            let arg_7 = wrap_in_language_error(arguments.get(7))?;
2122
2123            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
2124
2125            Ok(result.into_value_with_environment(env).to_raw(gc))
2126        })
2127    }
2128}
2129
2130impl<Fun, Ret, Recv, A, B, C, D, E, F, G, H>
2131    ForeignFunction<
2132        ffvariants::InfallibleSelf<
2133            ffvariants::MutableSelf<Recv>,
2134            (&mut Recv, A, B, C, D, E, F, G, H),
2135        >,
2136    > for Fun
2137where
2138    Fun: Fn(&mut Recv, A, B, C, D, E, F, G, H) -> Ret + 'static,
2139    Ret: IntoValue + 'static,
2140    Recv: MutSelfFromRawValue + 'static,
2141    A: TryFromValue + 'static,
2142    B: TryFromValue + 'static,
2143    C: TryFromValue + 'static,
2144    D: TryFromValue + 'static,
2145    E: TryFromValue + 'static,
2146    F: TryFromValue + 'static,
2147    G: TryFromValue + 'static,
2148    H: TryFromValue + 'static,
2149{
2150    type ParameterCount = MethodParameterCount;
2151    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
2152
2153    fn into_raw_foreign_function(self) -> RawForeignFunction {
2154        Box::new(move |env, gc, args| {
2155            let arguments = Arguments::new(args, env);
2156            let (arg_self, _guard) = wrap_in_language_error(unsafe {
2157                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
2158            })?;
2159            let arg_0 = wrap_in_language_error(arguments.get(0))?;
2160            let arg_1 = wrap_in_language_error(arguments.get(1))?;
2161            let arg_2 = wrap_in_language_error(arguments.get(2))?;
2162            let arg_3 = wrap_in_language_error(arguments.get(3))?;
2163            let arg_4 = wrap_in_language_error(arguments.get(4))?;
2164            let arg_5 = wrap_in_language_error(arguments.get(5))?;
2165            let arg_6 = wrap_in_language_error(arguments.get(6))?;
2166            let arg_7 = wrap_in_language_error(arguments.get(7))?;
2167
2168            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
2169
2170            Ok(result.into_value_with_environment(env).to_raw(gc))
2171        })
2172    }
2173}
2174
2175impl<Fun, Ret, Err, Recv, A, B, C, D, E, F, G, H>
2176    ForeignFunction<
2177        ffvariants::FallibleSelf<ffvariants::ImmutableSelf<Recv>, (&Recv, A, B, C, D, E, F, G, H)>,
2178    > for Fun
2179where
2180    Fun: Fn(&Recv, A, B, C, D, E, F, G, H) -> Result<Ret, Err> + 'static,
2181    Ret: IntoValue + 'static,
2182    Err: std::error::Error + 'static,
2183    Recv: SelfFromRawValue + 'static,
2184    A: TryFromValue + 'static,
2185    B: TryFromValue + 'static,
2186    C: TryFromValue + 'static,
2187    D: TryFromValue + 'static,
2188    E: TryFromValue + 'static,
2189    F: TryFromValue + 'static,
2190    G: TryFromValue + 'static,
2191    H: TryFromValue + 'static,
2192{
2193    type ParameterCount = MethodParameterCount;
2194    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
2195
2196    fn into_raw_foreign_function(self) -> RawForeignFunction {
2197        Box::new(move |env, gc, args| {
2198            let arguments = Arguments::new(args, env);
2199            let (arg_self, _guard) = wrap_in_language_error(unsafe {
2200                <Recv as SelfFromRawValue>::self_from_raw_value(arguments.raw_self())
2201            })?;
2202            let arg_0 = wrap_in_language_error(arguments.get(0))?;
2203            let arg_1 = wrap_in_language_error(arguments.get(1))?;
2204            let arg_2 = wrap_in_language_error(arguments.get(2))?;
2205            let arg_3 = wrap_in_language_error(arguments.get(3))?;
2206            let arg_4 = wrap_in_language_error(arguments.get(4))?;
2207            let arg_5 = wrap_in_language_error(arguments.get(5))?;
2208            let arg_6 = wrap_in_language_error(arguments.get(6))?;
2209            let arg_7 = wrap_in_language_error(arguments.get(7))?;
2210
2211            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
2212
2213            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
2214        })
2215    }
2216}
2217
2218impl<Fun, Ret, Err, Recv, A, B, C, D, E, F, G, H>
2219    ForeignFunction<
2220        ffvariants::FallibleSelf<
2221            ffvariants::MutableSelf<Recv>,
2222            (&mut Recv, A, B, C, D, E, F, G, H),
2223        >,
2224    > for Fun
2225where
2226    Fun: Fn(&mut Recv, A, B, C, D, E, F, G, H) -> Result<Ret, Err> + 'static,
2227    Ret: IntoValue + 'static,
2228    Err: std::error::Error + 'static,
2229    Recv: MutSelfFromRawValue + 'static,
2230    A: TryFromValue + 'static,
2231    B: TryFromValue + 'static,
2232    C: TryFromValue + 'static,
2233    D: TryFromValue + 'static,
2234    E: TryFromValue + 'static,
2235    F: TryFromValue + 'static,
2236    G: TryFromValue + 'static,
2237    H: TryFromValue + 'static,
2238{
2239    type ParameterCount = MethodParameterCount;
2240    const PARAMETER_COUNT: Self::ParameterCount = Self::ParameterCount::from_count_with_self(9);
2241
2242    fn into_raw_foreign_function(self) -> RawForeignFunction {
2243        Box::new(move |env, gc, args| {
2244            let arguments = Arguments::new(args, env);
2245            let (arg_self, _guard) = wrap_in_language_error(unsafe {
2246                <Recv as MutSelfFromRawValue>::mut_self_from_raw_value(arguments.raw_self())
2247            })?;
2248            let arg_0 = wrap_in_language_error(arguments.get(0))?;
2249            let arg_1 = wrap_in_language_error(arguments.get(1))?;
2250            let arg_2 = wrap_in_language_error(arguments.get(2))?;
2251            let arg_3 = wrap_in_language_error(arguments.get(3))?;
2252            let arg_4 = wrap_in_language_error(arguments.get(4))?;
2253            let arg_5 = wrap_in_language_error(arguments.get(5))?;
2254            let arg_6 = wrap_in_language_error(arguments.get(6))?;
2255            let arg_7 = wrap_in_language_error(arguments.get(7))?;
2256
2257            let result = self(arg_self, arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7);
2258
2259            wrap_in_language_error(result.map(|v| v.into_value_with_environment(env).to_raw(gc)))
2260        })
2261    }
2262}