pub struct BoundPacketView<Perms: PacketPerms> { /* private fields */ }Expand description
Bound Packet View.
Views may be bound to an output reference before being sent to the I/O backend. If the packet is bound to such output ref, then, upon completion of processing, every resulting packet view is passed to the given output ref.
Implementations§
Source§impl<Perms: PacketPerms> BoundPacketView<Perms>
impl<Perms: PacketPerms> BoundPacketView<Perms>
Sourcepub unsafe fn forget(self)
pub unsafe fn forget(self)
Forget the packet
§Safety
This packet must have originally been the receiver of BoundPacketView::extract_packet
call. There must be one extracted packet split left.
Sourcepub unsafe fn extract_packet(&self, pos: u64, len: u64) -> Self
pub unsafe fn extract_packet(&self, pos: u64, len: u64) -> Self
Extract a sub-packet from this packet
§Safety
To avoid undefined behavior, the caller must ensure the following conditions are met:
-
Extracted packets do not overlap each other.
-
Entire range of
selfmust be extracted. -
Before the last extracted packet is dropped,
selfmust be released withBoundPacketView::forget.
Sourcepub fn try_alloc(self) -> MaybeAlloced<Perms>
pub fn try_alloc(self) -> MaybeAlloced<Perms>
Tries allocating data for the packet view with 1 byte alignment.
Sourcepub unsafe fn unbound(&self) -> PacketView<'static, Perms>
pub unsafe fn unbound(&self) -> PacketView<'static, Perms>
Get an unbound Packet.
This function allows the packet to be rebound to a different I/O backend and have their results intercepted.
§Safety
Please see PacketView::extract_packet documentation for details.
Sourcepub unsafe fn transfer_data(
self,
input: Perms::ReverseDataType,
) -> TransferredPacket<Perms>
pub unsafe fn transfer_data( self, input: Perms::ReverseDataType, ) -> TransferredPacket<Perms>
Transfers data between the packet and the input.
If packet has Read permissions, input will be written to. If packet has
Write permissions, input will be read.
If packet has ReadWrite permissions, behavior is not fully specified,
but currently buffers perform memory swap operation.
§Safety
The caller must ensure that input pointer is sufficient for the bounds of the packet. In
addition, the data pointed by input must be properly initialized and byte-addressible.