https://github.com/drift-labs/drift-macros
https://github.com/drift-labs/drift-macros
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/drift-labs/drift-macros
- Owner: drift-labs
- Created: 2023-09-09T21:02:32.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-07T22:33:58.000Z (over 1 year ago)
- Last Synced: 2025-01-20T17:27:21.342Z (4 months ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# drift macros
misc helpful macros## #[assert_no_slop]
throws compile-time error if repr(C) struct has hidden padding (slop)
```rust
#[assert_no_slop]
#[account(zero_copy)]
#[repr(C)]
pub struct Foo {
pub bar: u128,
pub baz: u8,
pub qux: u128,
}
```this will throw a compile-time error because `Foo` has 7 bytes of hidden padding between `baz` and `qux`