pub struct Packets {}
Expand description
Structure for storing functions related to creation of packets
Implementations
sourceimpl Packets
impl Packets
sourcepub fn response<C: Codec>(packet: &OpaquePacket, contents: &C) -> OpaquePacket
pub fn response<C: Codec>(packet: &OpaquePacket, contents: &C) -> OpaquePacket
Creates a new response packet for responding to the provided
decodable packet. With the contents
pub fn response_raw(packet: &OpaquePacket, contents: Vec<u8>) -> OpaquePacket
sourcepub fn response_empty(packet: &OpaquePacket) -> OpaquePacket
pub fn response_empty(packet: &OpaquePacket) -> OpaquePacket
Shortcut function for creating a response packet with no content
sourcepub fn error<C: Codec>(
packet: &OpaquePacket,
error: impl Into<u16>,
contents: &C
) -> OpaquePacket
pub fn error<C: Codec>(
packet: &OpaquePacket,
error: impl Into<u16>,
contents: &C
) -> OpaquePacket
Creates a new error response packet for responding to the
provided packet with an error number with contents
sourcepub fn error_empty(packet: &OpaquePacket, error: impl Into<u16>) -> OpaquePacket
pub fn error_empty(packet: &OpaquePacket, error: impl Into<u16>) -> OpaquePacket
Shortcut function for creating an error packet with no content
sourcepub fn notify<C: Codec, T: PacketComponents>(
component: T,
contents: &C
) -> OpaquePacket
pub fn notify<C: Codec, T: PacketComponents>(
component: T,
contents: &C
) -> OpaquePacket
Creates a new notify packet with the provided component and command
and contents
pub fn notify_raw<T: PacketComponents>(
component: T,
contents: Vec<u8>
) -> OpaquePacket
sourcepub fn notify_empty<T: PacketComponents>(component: T) -> OpaquePacket
pub fn notify_empty<T: PacketComponents>(component: T) -> OpaquePacket
Shortcut function for creating a notify packet with no content
sourcepub fn request<C: Codec, T: PacketComponents>(
id: u16,
component: T,
contents: &C
) -> OpaquePacket
pub fn request<C: Codec, T: PacketComponents>(
id: u16,
component: T,
contents: &C
) -> OpaquePacket
Creates a new request packet retrieving its ID from the provided request counter.
sourcepub fn request_empty<T: PacketComponents>(id: u16, component: T) -> OpaquePacket
pub fn request_empty<T: PacketComponents>(id: u16, component: T) -> OpaquePacket
Creates a new request packet retrieving its ID from the provided request counter.
Auto Trait Implementations
impl RefUnwindSafe for Packets
impl Send for Packets
impl Sync for Packets
impl Unpin for Packets
impl UnwindSafe for Packets
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more