Struct PacketHeader
pub struct PacketHeader {
pub buffer_lifetime_ordinal: Option<u64>,
pub packet_index: Option<u32>,
/* private fields */
}
Expand description
PacketHeader
When referring to a free packet, we use PacketHeader alone instead of Packet, since while a packet is free it doesn’t really have meaningful offset or length etc.
A populated Packet also has a PacketHeader.
Fields§
§buffer_lifetime_ordinal: Option<u64>
This is which buffer configuration lifetime this header is referring to.
A packet_index is only really meaningful with respect to a particular buffer_lifetime_ordinal.
See StreamBufferPartialSettings.buffer_lifetime_ordinal.
For QueueInputPacket(), a server receiving a buffer_lifetime_ordinal that isn’t the current input buffer_lifetime_ordinal will close the channel.
For OnFreeInputPacket() and RecycleOutputPacket(), the receiver (client or server) must ignore a message with stale buffer_lifetime_ordinal.
packet_index: Option<u32>
The overall set of packet_index values is densely packed from 0..count-1 for input and output separately. They can be queued in any order.
Both the client and server should validate the packet_index against the known bound and disconnect if it’s out of bounds.
When running in single-buffer mode, the buffer index is always 0.
The packet_index values don’t imply anything about order of use of packets. The client should not expect the ordering to remain the same over time - the stream processor is free to hold on to an input or output packet for a while during which other packet_index values may be used multiple times.
For a given properly-functioning StreamProcessor instance, packet_index values will be unique among concurrently-outstanding packets. Servers should validate that a client isn’t double-using a packet and clients should validate as necessary to avoid undefined or unexpected client behavior.
Trait Implementations§
§impl Clone for PacketHeader
impl Clone for PacketHeader
§fn clone(&self) -> PacketHeader
fn clone(&self) -> PacketHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for PacketHeader
impl Debug for PacketHeader
§impl<D> Decode<PacketHeader, D> for PacketHeaderwhere
D: ResourceDialect,
impl<D> Decode<PacketHeader, D> for PacketHeaderwhere
D: ResourceDialect,
§fn new_empty() -> PacketHeader
fn new_empty() -> PacketHeader
Self
. The specific value does not matter,
since it will be overwritten by decode
.§impl Default for PacketHeader
impl Default for PacketHeader
§fn default() -> PacketHeader
fn default() -> PacketHeader
§impl<D> Encode<PacketHeader, D> for &PacketHeaderwhere
D: ResourceDialect,
impl<D> Encode<PacketHeader, D> for &PacketHeaderwhere
D: ResourceDialect,
§impl PartialEq for PacketHeader
impl PartialEq for PacketHeader
§impl TypeMarker for PacketHeader
impl TypeMarker for PacketHeader
§type Owned = PacketHeader
type Owned = PacketHeader
§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read more§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.§impl ValueTypeMarker for PacketHeader
impl ValueTypeMarker for PacketHeader
§type Borrowed<'a> = &'a PacketHeader
type Borrowed<'a> = &'a PacketHeader
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read more§fn borrow(
value: &<PacketHeader as TypeMarker>::Owned,
) -> <PacketHeader as ValueTypeMarker>::Borrowed<'_>
fn borrow( value: &<PacketHeader as TypeMarker>::Owned, ) -> <PacketHeader as ValueTypeMarker>::Borrowed<'_>
&Self::Owned
to Self::Borrowed
.