chore: make IDL internal components public for crate consumers#82
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughSix internal modules in Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@shank-idl/src/lib.rs`:
- Around line 10-16: The idl_error_code module is private but its IdlErrorCode
type is exposed via the public Idl struct's errors field; change the module
declaration for idl_error_code (currently "mod idl_error_code;") to be public
("pub mod idl_error_code;") so external crates can import IdlErrorCode and
related items; update the module declaration where idl_error_code is declared to
match other public idl_* modules and ensure consumers can reference IdlErrorCode
when using Idl::errors.
| mod idl_error_code; | ||
| mod idl_field; | ||
| mod idl_instruction; | ||
| mod idl_metadata; | ||
| mod idl_type; | ||
| mod idl_type_definition; | ||
| mod idl_variant; | ||
| pub mod idl_field; | ||
| pub mod idl_instruction; | ||
| pub mod idl_metadata; | ||
| pub mod idl_type; | ||
| pub mod idl_type_definition; | ||
| pub mod idl_variant; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the structure and usage of idl_error_code module
echo "=== Finding idl_error_code file ==="
fd -t f "idl_error_code" shank-idl/
echo ""
echo "=== Contents of idl_error_code.rs ==="
cat shank-idl/src/idl_error_code.rs
echo ""
echo "=== Check imports of idl_error_code in other modules ==="
rg "idl_error_code" shank-idl/src/ -A 2 -B 2
echo ""
echo "=== List all files in shank-idl/src ==="
ls -la shank-idl/src/Repository: metaplex-foundation/shank
Length of output: 2377
🏁 Script executed:
#!/bin/bash
# Check if IdlErrorCode is re-exported from public modules
echo "=== Check idl.rs (public module) exports ==="
head -30 shank-idl/src/idl.rs
echo ""
echo "=== Check if IdlErrorCode is in public signatures ==="
rg "IdlErrorCode" shank-idl/src/idl.rs -B 3 -A 3
echo ""
echo "=== Full lib.rs to see the complete module structure ==="
cat shank-idl/src/lib.rs
echo ""
echo "=== Check if any public module re-exports IdlErrorCode ==="
rg "pub.*IdlErrorCode|pub use.*idl_error_code" shank-idl/src/Repository: metaplex-foundation/shank
Length of output: 3811
Make idl_error_code module public for API consistency.
The IdlErrorCode struct is used in the public Idl struct's errors field but cannot be directly imported by external crate consumers because the module is private. Change line 10 from mod idl_error_code; to pub mod idl_error_code; to align with the other public idl_* modules and allow users to properly work with error code definitions in the public API.
🤖 Prompt for AI Agents
In `@shank-idl/src/lib.rs` around lines 10 - 16, The idl_error_code module is
private but its IdlErrorCode type is exposed via the public Idl struct's errors
field; change the module declaration for idl_error_code (currently "mod
idl_error_code;") to be public ("pub mod idl_error_code;") so external crates
can import IdlErrorCode and related items; update the module declaration where
idl_error_code is declared to match other public idl_* modules and ensure
consumers can reference IdlErrorCode when using Idl::errors.
|
Looks good, thank you for the PR! This will be shipped in the next release, today. |
Don't know if this is something you're open to, but if so, fixes #49 :)