[−][src]Struct laminar::Packet
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]
addr: SocketAddr,
payload: Vec<u8>,
stream_id: Option<u8>
) -> Packet
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]
addr: SocketAddr,
payload: Vec<u8>,
stream_id: Option<u8>
) -> Packet
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 asNone
the default stream will be used; if you are not sure what this is you can leave it atNone
.
pub fn reliable_sequenced(
addr: SocketAddr,
payload: Vec<u8>,
stream_id: Option<u8>
) -> Packet
[src]
addr: SocketAddr,
payload: Vec<u8>,
stream_id: Option<u8>
) -> Packet
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 asNone
the default stream will be used; if you are not sure what this is you can leave it atNone
.
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 Eq for Packet
[src]
impl Clone for Packet
[src]
fn clone(&self) -> Packet
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<Packet> for Packet
[src]
impl Debug for Packet
[src]
Auto Trait Implementations
impl Unpin for Packet
impl Sync for Packet
impl Send for Packet
impl UnwindSafe for Packet
impl RefUnwindSafe for Packet
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,