Skip to content

Commit

Permalink
coap-message: Bump to 0.1.1 to make payload_mut more usable
Browse files Browse the repository at this point in the history
Using coap-message with coap-lite has shown its MutableWritableMessage's
limitations when used with dynamically allocated payloads; the new
added method fixes this.
  • Loading branch information
chrysn committed Feb 7, 2021
1 parent 52c7101 commit 9499633
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ edition = "2018"
doctest = false

[dependencies]
coap-message = { version = "0.1.0", optional = true }
coap-message = { version = "0.1.1", optional = true }

[features]
default = ["std"]
Expand Down
4 changes: 4 additions & 0 deletions src/impl_coap_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ impl MutableWritableMessage for Packet {
fn payload_mut(&mut self) -> &mut [u8] {
&mut self.payload
}
fn payload_mut_with_len(&mut self, len: usize) -> &mut [u8] {
self.payload.resize(len, 0);
&mut self.payload
}
fn truncate(&mut self, length: usize) {
self.payload.truncate(length)
}
Expand Down

0 comments on commit 9499633

Please sign in to comment.