Bug: emit! and require! macros fail to compile due to private module access #97
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jwilger/eventcore#97
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The
emit!andrequire!macros documented in eventcore 0.1.3 fail to compile because they attempt to access private modules within the eventcore crate.Steps to Reproduce
emit!macro in a command handler:require!macro for validation:Expected Behavior
Both macros should compile successfully and provide the documented functionality:
emit!should simplify event creationrequire!should simplify business rule validationActual Behavior
Compilation fails with the following errors:
Analysis
The macros are trying to access:
$crate::command::StreamWriteinstead of$crate::StreamWrite$crate::errors::CommandErrorinstead of$crate::CommandErrorSince these types are re-exported at the crate root but the modules themselves are private, the macro expansion fails.
Workaround
Until fixed, users can use the manual approach:
Instead of
require!(condition, "error message"):Instead of
emit!(events, &read_streams, stream_id, event):Environment
Related
This issue was discovered while implementing eventcore in the union_square project: https://github.com/jwilger/union_square/pull/107
The
#[derive(Command)]macro from eventcore-macros works correctly - only theemit!andrequire!macros are affected.