(self, eval: F)
| 373 | } |
| 374 | |
| 375 | pub fn vectorized<F>(self, eval: F) -> B |
| 376 | where F: VectorizedFn0<O> + 'static { |
| 377 | let Self { |
| 378 | builder, |
| 379 | return_type, |
| 380 | calc_domain, |
| 381 | derive_stat, |
| 382 | } = self; |
| 383 | let mut builder = builder; |
| 384 | let calc_domain = calc_domain.expect("typed calc_domain must be specified"); |
| 385 | |
| 386 | let signature = FunctionSignature { |
| 387 | name: builder.name().to_string(), |
| 388 | args_type: Vec::new(), |
| 389 | return_type: return_type.clone(), |
| 390 | }; |
| 391 | |
| 392 | let calc_wrapper = TypedNullaryCalcDomain { |
| 393 | calc_domain, |
| 394 | return_type: return_type.clone(), |
| 395 | _marker: PhantomData, |
| 396 | }; |
| 397 | let eval_wrapper = TypedNullaryFunction { |
| 398 | func: eval, |
| 399 | return_type, |
| 400 | _marker: PhantomData, |
| 401 | }; |
| 402 | |
| 403 | builder.collect(Function { |
| 404 | signature, |
| 405 | eval: FunctionEval::Scalar { |
| 406 | calc_domain: Box::new(calc_wrapper), |
| 407 | eval: Box::new(eval_wrapper), |
| 408 | derive_stat: derive_stat.map(|eval| Box::new(eval) as _), |
| 409 | }, |
| 410 | }); |
| 411 | builder |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | #[derive(Clone)] |
no test coverage detected