-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
774 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[package] | ||
name = "gix-macros" | ||
version = "0.0.0" | ||
edition = "2021" | ||
description = "Proc-macro utilities for gix" | ||
authors = [ | ||
"Jiahao XU <Jiahao_XU@outlook.com>", | ||
"Andre Bogus <bogusandre@gmail.com>", | ||
"Sebastian Thiel <sebastian.thiel@icloud.com>", | ||
] | ||
repository = "https://github.com/Byron/gitoxide" | ||
license = "MIT OR Apache-2.0" | ||
include = ["src/**/*", "LICENSE-*", "CHANGELOG.md"] | ||
rust-version = "1.65" | ||
|
||
[lib] | ||
proc_macro = true | ||
|
||
[dependencies] | ||
syn = { version = "2.0", features = ["full", "fold"] } | ||
quote = "1.0" | ||
proc-macro2 = "1.0" | ||
|
||
[dev-dependencies] | ||
trybuild = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../LICENSE-APACHE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../LICENSE-MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! A crate of useful macros used in `gix` primarily. | ||
//! | ||
//! Note that within `gix-*` crates, monomorphization should never be used for convenience, but only for performance | ||
//! reasons. And in the latter case, manual denomophization should be considered if the trait in questions isn't called | ||
//! often enough or measurements indicate that `&dyn Trait` is increasing the runtime. Thus, `gix-*` crates should probably | ||
//! by default prefer using `&dyn` unless measurements indicate otherwise. | ||
use proc_macro::TokenStream; | ||
|
||
/// When applied to functions or methods, it will turn it into a wrapper that will immediately call | ||
/// a de-monomorphized implementation (i.e. one that uses `&dyn Trait`). | ||
/// | ||
/// That way, the landing-pads for convenience will be as small as possible which then delegate to a single | ||
/// function or method for implementation. | ||
/// | ||
/// The parameters using the following traits can be de-monomorphized: | ||
/// | ||
/// * `Into` | ||
/// * `AsRef` | ||
/// * `AsMut` | ||
#[proc_macro_attribute] | ||
pub fn momo(_attrs: TokenStream, input: TokenStream) -> TokenStream { | ||
momo::inner(input.into()).into() | ||
} | ||
|
||
mod momo; |
Oops, something went wrong.