Struct laminar::Packet[][src]

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 TypePacket DropPacket DuplicationPacket OrderPacket FragmentationPacket Delivery
Unreliable UnorderedAnyYesNoNoNo
Unreliable SequencedAny + oldNoSequencedNoNo
Reliable UnorderedNoNoNoYesYes
Reliable OrderedNoNoOrderedYesYes
Reliable SequencedOnly oldNoSequencedYesOnly newest

You are able to send packets with the above reliability types.

Implementations

impl Packet[src]

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

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

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

Details

Packet DropPacket DuplicationPacket OrderPacket FragmentationPacket Delivery
AnyYesNoNoNo

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]

Creates 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 DropPacket DuplicationPacket OrderPacket FragmentationPacket Delivery
Any + oldNoSequencedNoNo

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]

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

Details

Packet DropPacket DuplicationPacket OrderPacket FragmentationPacket Delivery
NoNoNoYesYes

Basically this is almost TCP without ordering of packets.

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

Creates 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 DropPacket DuplicationPacket OrderPacket FragmentationPacket Delivery
NoNoOrderedYesYes

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]

Creates 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 DropPacket DuplicationPacket OrderPacket FragmentationPacket Delivery
Only oldNoSequencedYesOnly newest

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 Clone for Packet[src]

fn clone(&self) -> Packet[src]

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Debug for Packet[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl PartialEq<Packet> for Packet[src]

fn eq(&self, other: &Packet) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Packet) -> bool[src]

This method tests for !=.

impl Eq for Packet[src]

impl StructuralEq for Packet[src]

impl StructuralPartialEq for Packet[src]

Auto Trait Implementations

impl RefUnwindSafe for Packet

impl Send for Packet

impl Sync for Packet

impl Unpin for Packet

impl UnwindSafe for Packet

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

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

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V