1#![cfg_attr(not(feature = "std"), no_std)]
2
3#[allow(unused_imports)]
5#[macro_use]
6extern crate model_mapper_macros;
7#[doc(hidden)]
8pub use model_mapper_macros::*;
9
10#[doc(hidden)]
11pub mod private {
12 pub trait RefMapper<T, R> {
13 fn map_value(&self, arg: T) -> R;
14 }
15 impl<F, T, R> RefMapper<T, R> for F
16 where
17 F: ?Sized + Fn(&T) -> R,
18 {
19 #[inline(always)]
20 fn map_value(&self, arg: T) -> R {
21 (self)(&arg)
22 }
23 }
24
25 pub trait ValueMapper<T, R> {
26 fn map_value(&self, arg: T) -> R;
27 }
28 impl<F, T, R> ValueMapper<T, R> for &F
29 where
30 F: ?Sized + Fn(T) -> R,
31 {
32 #[inline(always)]
33 fn map_value(&self, arg: T) -> R {
34 (*self)(arg)
35 }
36 }
37}