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 Type | Packet Drop | Packet Duplication | Packet Order | Packet Fragmentation | Packet Delivery |
---|---|---|---|---|---|
Unreliable Unordered | Any | Yes | No | No | No |
Unreliable Sequenced | Any + old | No | Sequenced | No | No |
Reliable Unordered | No | No | No | Yes | Yes |
Reliable Ordered | No | No | Ordered | Yes | Yes |
Reliable Sequenced | Only old | No | Sequenced | Yes | Only newest |
You are able to send packets with the above reliability types.
Implementations
impl Packet
[src]
impl Packet
[src]pub fn unreliable(addr: SocketAddr, payload: Vec<u8>) -> 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 Drop | Packet Duplication | Packet Order | Packet Fragmentation | Packet Delivery |
---|---|---|---|---|
Any | 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]
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 Drop | Packet Duplication | Packet Order | Packet Fragmentation | Packet Delivery |
---|---|---|---|---|
Any + old | No | 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]
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 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]
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 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]
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 Drop | Packet Duplication | Packet Order | Packet Fragmentation | Packet Delivery |
---|---|---|---|---|
Only old | No | Sequenced | Yes | Only newest |
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 addr(&self) -> SocketAddr
[src]
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]
pub fn delivery_guarantee(&self) -> DeliveryGuarantee
[src]Returns the DeliveryGuarantee
of this packet.
pub fn order_guarantee(&self) -> OrderingGuarantee
[src]
pub fn order_guarantee(&self) -> OrderingGuarantee
[src]Returns the OrderingGuarantee
of this packet.
Trait Implementations
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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
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]
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<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,