File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
- //! A crate of
1
+ //! A crate of useful macros used in `gix` primarily.
2
+ //!
3
+ //! Note that within `gix-*` crates, monomorphization should never be used for convenience, but only for performance
4
+ //! reasons. And in the latter case, manual denomophization should be considered if the trait in questions isn't called
5
+ //! often enough or measurements indicate that `&dyn Trait` is increasing the runtime. Thus, `gix-*` crates should probably
6
+ //! by default prefer using `&dyn` unless measurements indicate otherwise.
2
7
use proc_macro:: TokenStream ;
3
8
4
- /// Generate lightweight monomorphized wrapper around main implementation.
5
- /// May be applied to functions and methods.
9
+ /// When applied to functions or methods, it will turn it into a wrapper that will immediately call
10
+ /// a de-monomorphized implementation (i.e. one that uses `&dyn Trait`).
11
+ ///
12
+ /// That way, the landing-pads for convenience will be as small as possible which then delegate to a single
13
+ /// function or method for implementation.
14
+ ///
15
+ /// The parameters using the following traits can be de-monomorphized:
16
+ ///
17
+ /// * `Into`
18
+ /// * `AsRef`
19
+ /// * `AsMut`
6
20
#[ proc_macro_attribute]
7
21
pub fn momo ( _attrs : TokenStream , input : TokenStream ) -> TokenStream {
8
22
//TODO: alternatively parse ImplItem::Method
You can’t perform that action at this time.
0 commit comments