a2svior
(Valentin)
August 6, 2025, 5:19pm
1
Is there any good way to get a packed struct or control alignment in Mojo currently? Essentially I want the equivalent of the following Rust code, can’t seem to find a good way to do it. Searching the docs didn’t help
#[repr(C, packed)]
struct MyStruct();
#[repr(align(64))]
struct MyStruct();
Also packed + aligned for those of us doing networking!
I don’t think there’s a way to do this right now.
1 Like
Caroline
(Caroline Frasca)
August 7, 2025, 7:39pm
3
Hi @a2svior ,
Thanks for sharing this question! I confirmed with the team that this is unfortunately not possible today (but will be needed in the future!).
3 Likes
a2svior
(Valentin)
August 7, 2025, 7:49pm
4
Okay, thanks for letting me know!
1 Like
denis
(Denis Gurchenkov)
August 12, 2025, 8:24pm
5
1 Like
a2svior
(Valentin)
August 13, 2025, 4:22pm
6
Many thanks! Excited about this
Hundo
(Hundo)
August 20, 2025, 7:18am
7
I’m interested in this too. I initially thought Layout handled this, but I realize Layout is for MAX’s linear algebra memory mapping.
Perhaps Layout could be separated from MAX and generalized to cover more common memory representation cases.
system
(system)
Closed
February 16, 2026, 7:19am
8
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.