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

Return number of bytes written to buffer from encode() #28

Merged
merged 1 commit into from
May 2, 2020

Conversation

MathiasKoch
Copy link
Contributor

This PR add a return value to encode(), in order to allow using it with types that implement BufMut without keeping track of length, such as raw byte slices as

let mut tx_buf: [u8; 2048] = [0; 2048];
let size = encode(&pkt, &mut &mut tx_buf[..])?;
network.write(socket, &tx_buf[..size]);

@00imvj00 00imvj00 merged commit 1575acf into 00imvj00:master May 2, 2020
@00imvj00
Copy link
Owner

00imvj00 commented May 2, 2020

thank you @MathiasKoch

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

Successfully merging this pull request may close these issues.

2 participants