[−][src]Trait ethox::wire::PayloadMut
A specialized, internal variant of BorrowMut<payload>
.
This ensures that the implementation is also consistent and always resolves to the same memory region, an implementation detail that other parts of the crate could rely upon. The guarantee is that the values in the referred to byte region will not appear differently, which is trivial when we guarantee that the byte region is part of our object and does not change.
Required methods
fn resize(&mut self, length: usize) -> Result<(), Error>
Resize the payload.
New bytes will be intialized with some value, likely 0
but not guaranteed.
fn reframe(&mut self, reframe: Reframe) -> Result<(), Error>
Resize the payload while keeping some data.
Should either fully work or outright fail. The given range of payload data must be logically unchanged. In particular it should also be placed at the same relative position in the payload.
The implementation only ever has to preserve the overlap between keep
and the current and
the new payload length. It is valid to pass in 0..usize::MAX
to keep all of the payload
which fits into the resize length. When resized to a larger frame the initialization should
be 0
but this must not be relied upon.
fn payload_mut(&mut self) -> &mut payload
Retrieve the mutable, inner payload.