-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove storage-plus dependency from storage-macro #817
Changes from 4 commits
263ff5c
7cf390f
dfa8998
ce2300f
292458d
d037bf5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,25 @@ use syn::{ | |
parse_macro_input, ItemStruct, | ||
}; | ||
|
||
/// Auto generate an `IndexList` impl for your indexes struct. | ||
/// | ||
/// # Example | ||
/// | ||
/// ```rust | ||
/// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] | ||
/// struct TestStruct { | ||
/// id: u64, | ||
/// id2: u32, | ||
/// addr: Addr, | ||
/// } | ||
/// | ||
/// #[index_list(TestStruct)] // <- Add this line right here. | ||
/// struct TestIndexes<'a> { | ||
/// id: MultiIndex<'a, u32, TestStruct, u64>, | ||
/// addr: UniqueIndex<'a, Addr, TestStruct>, | ||
/// } | ||
/// ``` | ||
/// | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, so normally macro docs would live in the Does this example pass when tested? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, it does not. I'll move it to the reexport |
||
#[proc_macro_attribute] | ||
pub fn index_list(attr: TokenStream, item: TokenStream) -> TokenStream { | ||
let input = parse_macro_input!(item as ItemStruct); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI: the way the version requirements are specified here is a hack to make a cyclic dependency publishable to crates.io. Good thing we don't actually need it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good that this is not needed, yes. Thanks for working on simplifying this.