[][src]Trait ethox::wire::PayloadMut

pub trait PayloadMut: Payload {
    fn resize(&mut self, length: usize) -> Result<(), Error>;
fn reframe(&mut self, reframe: Reframe) -> Result<(), Error>;
fn payload_mut(&mut self) -> &mut payload; }

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.

Loading content...

Implementations on Foreign Types

impl PayloadMut for Vec<u8>[src]

Loading content...

Implementors

impl PayloadMut for payload[src]

impl PayloadMut for [u8][src]

impl<'_> PayloadMut for Slice<'_, u8>[src]

impl<'_, P: PayloadMut + ?Sized> PayloadMut for &'_ mut P[src]

impl<'_, P: PayloadMut> PayloadMut for Out<'_, P>[src]

impl<'a, P: PayloadMut> PayloadMut for IpPacket<'a, P>[src]

impl<C: PayloadMut> PayloadMut for Partial<C>[src]

impl<T: Payload + PayloadMut> PayloadMut for Frame<T>[src]

impl<T: Payload + PayloadMut> PayloadMut for ethox::wire::ip::v4::Packet<T>[src]

impl<T: Payload + PayloadMut> PayloadMut for ethox::wire::udp::Packet<T>[src]

impl<T: PayloadMut> PayloadMut for ethox::wire::ip::v6::Packet<T>[src]

Loading content...