[−][src]Struct amethyst_network::NetPacket
Represents a packet which could have any serializable payload.
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 |
Unreliable Sequenced | Yes | No | Sequenced | No | No |
Reliable Unordered | No | No | No | Yes | Yes |
Reliable Ordered | No | No | Ordered | Yes | Yes |
Reliable Sequenced | No | No | Sequenced | Yes | Yes |
You are able to send packets with any the above guarantees.
For more information please have a look at: https://amethyst.github.io/laminar/docs/reliability/reliability.html
Methods
impl<T> NetPacket<T>
[src]
pub fn unreliable(content: T) -> NetPacket<T>
[src]
Create a new unreliable packet with the given content.
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(content: T, stream_id: Option<u8>) -> NetPacket<T>
[src]
Create a new unreliable sequenced packet with the given content.
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(content: T) -> NetPacket<T>
[src]
Create a new packet with the given content. 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(content: T, stream_id: Option<u8>) -> NetPacket<T>
[src]
Create a new packet with the given content and 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(content: T, stream_id: Option<u8>) -> NetPacket<T>
[src]
Create a new packet with the given content and 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 is_reliable(&self) -> bool
[src]
Returns if this event is reliable.
Each net event type is either reliable or unreliable. Reliable events always reach their destination, unreliable events may be lost.
pub fn is_unreliable(&self) -> bool
[src]
Returns if this event is unreliable.
Each net event type is either reliable or unreliable. Reliable events always reach their destination, unreliable events may be lost.
pub fn is_ordered(&self) -> bool
[src]
Returns whether this event is an ordered event.
pub fn is_sequenced(&self) -> bool
[src]
Returns whether this event is an sequenced event.
pub fn is_unordered(&self) -> bool
[src]
Return if this event is neither ordered or sequenced.
pub fn content(&self) -> &T
[src]
Returns a immutable reference to the content.
pub fn content_mut(&mut self) -> &mut T
[src]
Returns a immutable reference to the content.
Trait Implementations
impl<T: Clone> Clone for NetPacket<T>
[src]
fn clone(&self) -> NetPacket<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq<NetPacket<T>> for NetPacket<T>
[src]
impl<T: Debug> Debug for NetPacket<T>
[src]
impl<T> Serialize for NetPacket<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de, T> Deserialize<'de> for NetPacket<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<T> Unpin for NetPacket<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for NetPacket<T> where
T: Sync,
T: Sync,
impl<T> Send for NetPacket<T> where
T: Send,
T: Send,
impl<T> UnwindSafe for NetPacket<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for NetPacket<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
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,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn is_in_subset(&self) -> bool
[src]
unsafe fn to_subset_unchecked(&self) -> SS
[src]
fn from_subset(element: &SS) -> SP
[src]
impl<T> Resource for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> Any for T where
T: Any,
[src]
T: Any,
fn get_type_id(&self) -> TypeId
[src]
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,