[][src]Struct laminar::Packet

pub struct Packet { /* fields omitted */ }

This is a user friendly packet containing the payload, endpoint, and reliability guarantees. A packet could have reliability guarantees to specify how it should be delivered and processed.

Reliability Type Packet Drop Packet Duplication Packet Order Packet Fragmentation Packet Delivery
Unreliable Unordered Yes Yes No No No
Reliable Unordered No No No Yes Yes
Reliable Ordered No No Ordered Yes Yes
Sequenced Yes No Sequenced No No

You are able to send packets with any the above guarantees.

Methods

impl Packet[src]

pub fn unreliable(addr: SocketAddr, payload: Vec<u8>) -> Packet[src]

Create a new unreliable packet by passing the receiver, data.

Unreliable: Packets can be dropped, duplicated or arrive without order.

Details

Packet Drop Packet Duplication Packet Order Packet Fragmentation Packet Delivery
Yes Yes No No No

Basically just bare UDP. The packet may or may not be delivered.

pub fn unreliable_sequenced(
    addr: SocketAddr,
    payload: Vec<u8>,
    stream_id: Option<u8>
) -> Packet
[src]

Create a new unreliable sequenced packet by passing the receiver, data.

Unreliable Sequenced; Packets can be dropped, but could not be duplicated and arrive in sequence.

Details

Packet Drop Packet Duplication Packet Order Packet Fragmentation Packet Delivery
Yes Yes Sequenced No No

Basically just bare UDP, free to be dropped, but has some sequencing to it so that only the newest packets are kept.

pub fn reliable_unordered(addr: SocketAddr, payload: Vec<u8>) -> Packet[src]

Create a new packet by passing the receiver, data. Reliable; All packets will be sent and received, but without order.

Details

Packet Drop Packet Duplication Packet Order Packet Fragmentation Packet Delivery
No No No Yes Yes

Basically this is almost TCP without ordering of packets.

pub fn reliable_ordered(
    addr: SocketAddr,
    payload: Vec<u8>,
    stream_id: Option<u8>
) -> Packet
[src]

Create a new packet by passing the receiver, data and a optional stream on which the ordering will be done.

Reliable; All packets will be sent and received, with order.

Details

Packet Drop Packet Duplication Packet Order Packet Fragmentation Packet Delivery
No No Ordered Yes Yes

Basically this is almost TCP-like with ordering of packets.

Remark

  • When stream_id is specified as None the default stream will be used; if you are not sure what this is you can leave it at None.

pub fn reliable_sequenced(
    addr: SocketAddr,
    payload: Vec<u8>,
    stream_id: Option<u8>
) -> Packet
[src]

Create a new packet by passing the receiver, data and a optional stream on which the sequencing will be done.

Reliable; All packets will be sent and received, but arranged in sequence. Which means that only the newest packets will be let through, older packets will be received but they won't get to the user.

Details

Packet Drop Packet Duplication Packet Order Packet Fragmentation Packet Delivery
Yes No Sequenced Yes Yes

Basically this is almost TCP-like but then sequencing instead of ordering.

Remark

  • When stream_id is specified as None the default stream will be used; if you are not sure what this is you can leave it at None.

pub fn payload(&self) -> &[u8][src]

Returns the payload of this packet.

pub fn addr(&self) -> SocketAddr[src]

Returns the address of this packet.

Remark

Could be both the receiving endpoint or the one to send this packet to. This depends whether it is a packet that has been received or one that needs to be send.

pub fn delivery_guarantee(&self) -> DeliveryGuarantee[src]

Returns the DeliveryGuarantee of this packet.

pub fn order_guarantee(&self) -> OrderingGuarantee[src]

Returns the OrderingGuarantee of this packet.

Trait Implementations

impl PartialEq<Packet> for Packet[src]

impl Clone for Packet[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Eq for Packet[src]

impl Debug for Packet[src]

Auto Trait Implementations

impl Send for Packet

impl Sync for Packet

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]