You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I have this kind of struct: 1 byte of string length, then the ASCII string itself, then padding up to 255 (the padding's length is 255-string length), and then some 3-byte value. So it looks like this:
I thought of building this struct with a PaddedString, but another requirement I need is to be able to use .sizeof() on it (for another use in a bigger library I am writing). This is not possible with PaddedString because the size of it can't be determined.
Is there some solution from construct for this? Obviously, I could simply use Byte[255] and slice the string myself, but I was wondering whether construct could do it on its own, while still having a fixed-sized struct.
Thanks!
The text was updated successfully, but these errors were encountered:
Let's say I have this kind of struct: 1 byte of string length, then the ASCII string itself, then padding up to 255 (the padding's length is
255-string length
), and then some 3-byte value. So it looks like this:I thought of building this struct with a
PaddedString
, but another requirement I need is to be able to use.sizeof()
on it (for another use in a bigger library I am writing). This is not possible withPaddedString
because the size of it can't be determined.Is there some solution from construct for this? Obviously, I could simply use
Byte[255]
and slice the string myself, but I was wondering whether construct could do it on its own, while still having a fixed-sized struct.Thanks!
The text was updated successfully, but these errors were encountered: