Skip to content

Commit

Permalink
Explain macro indirection
Browse files Browse the repository at this point in the history
`offset_of!` implementation was moved to an internal macro
`_memoffset__offset_of_impl!` in
[PR #72](#72).

This was done in order to have a single top-level macro that
doc-comments can be attached to.
  • Loading branch information
Gilnaa committed May 19, 2023
1 parent a380cb8 commit 033de8e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/offset_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ macro_rules! _memoffset__offset_of_impl {
#[macro_export(local_inner_macros)]
macro_rules! offset_of {
($parent:path, $field:tt) => {
// Macro implementation is delegated to another macro to have a
// single top-level macro to attach documentation to.
_memoffset__offset_of_impl!($parent, $field)
};
}
Expand Down Expand Up @@ -196,6 +198,8 @@ macro_rules! _memoffset__offset_of_union_impl {
#[macro_export(local_inner_macros)]
macro_rules! offset_of_union {
($parent:path, $field:tt) => {{
// Macro implementation is delegated to another macro to have a
// single top-level macro to attach documentation to.
_memoffset__offset_of_union_impl!($parent, $field)
}};
}
Expand Down

0 comments on commit 033de8e

Please sign in to comment.