Skip to main content

BoundPacketView

Struct BoundPacketView 

Source
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>

Source

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.

Source

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:

  1. Extracted packets do not overlap each other.

  2. Entire range of self must be extracted.

  3. Before the last extracted packet is dropped, self must be released with BoundPacketView::forget.

Source

pub fn try_alloc(self) -> MaybeAlloced<Perms>

Tries allocating data for the packet view with 1 byte alignment.

Source

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.

Source

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.

Source

pub fn ptr(&self) -> *const u8

Trait Implementations§

Source§

impl<Perms: PacketPerms> Drop for BoundPacketView<Perms>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: PacketPerms> Errorable for BoundPacketView<T>

Source§

fn error(self, err: Error)

Source§

impl<Perms: PacketPerms> From<BoundPacketView<Perms>> for StandardPktVariations<Perms>

Source§

fn from(p: BoundPacketView<Perms>) -> Self

Converts to this type from the input type.
Source§

impl From<BoundPacketView<Read>> for AnyPacket

Source§

fn from(p: BoundPacketView<Read>) -> Self

Converts to this type from the input type.
Source§

impl From<BoundPacketView<ReadWrite>> for AnyPacket

Source§

fn from(p: BoundPacketView<ReadWrite>) -> Self

Converts to this type from the input type.
Source§

impl<T: PacketPerms> From<BoundPacketView<T>> for ReboundPacket<T>

Source§

fn from(orig: BoundPacketView<T>) -> Self

Converts to this type from the input type.
Source§

impl From<BoundPacketView<Write>> for AnyPacket

Source§

fn from(p: BoundPacketView<Write>) -> Self

Converts to this type from the input type.
Source§

impl<T: PacketPerms> Splittable<u64> for BoundPacketView<T>

Source§

fn split_at(self, len: u64) -> (Self, Self)

Splits an object at given position. Read more
Source§

fn len(&self) -> u64

Source§

fn is_empty(&self) -> bool

Auto Trait Implementations§

§

impl<Perms> !RefUnwindSafe for BoundPacketView<Perms>

§

impl<Perms> !UnwindSafe for BoundPacketView<Perms>

§

impl<Perms> Freeze for BoundPacketView<Perms>

§

impl<Perms> Send for BoundPacketView<Perms>

§

impl<Perms> Sync for BoundPacketView<Perms>

§

impl<Perms> Unpin for BoundPacketView<Perms>

§

impl<Perms> UnsafeUnpin for BoundPacketView<Perms>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, F> From2<T> for F
where T: Into<F>,

Source§

fn from2(other: T) -> F

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GenericTypeBounds for T

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.