Skip to content

Commit 705f2f3

Browse files
committed
improve docs
1 parent 48a2088 commit 705f2f3

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

gix-macros/src/lib.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
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.
27
use proc_macro::TokenStream;
38

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`
620
#[proc_macro_attribute]
721
pub fn momo(_attrs: TokenStream, input: TokenStream) -> TokenStream {
822
//TODO: alternatively parse ImplItem::Method

0 commit comments

Comments
 (0)