Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for arbitrary sized byte array #9

Open
penumbra23 opened this issue Jun 23, 2022 · 1 comment
Open

Support for arbitrary sized byte array #9

penumbra23 opened this issue Jun 23, 2022 · 1 comment

Comments

@penumbra23
Copy link

Hi!

First of, thanks for the lib, I'm doing some PoC network protocols and by far it's solving the headache of OS endianness. My question is how can I support arbitrary sized byte array?

For example:

#[derive(PackedSize, EncodeBE, DecodeBE)]
pub struct Chat {
    group: [u8; 32],
    msg_size: u32,
    msg: [u8; 256],
}

msg should be max 256 bytes, the actual size is msg_size. Any idea how to overcome this? Or should I manually handle the data coming from the network?

@penumbra23 penumbra23 changed the title Support for byte array Support for arbitrary sized byte array Jun 23, 2022
@mbyzhang
Copy link

mbyzhang commented Jan 1, 2023

#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants