Enum StaticMessage
pub enum StaticMessage {
Text(&'static str),
Binary(&'static [u8]),
Control {
command: &'static str,
parameters: &'static str,
},
}Expand description
Zero-copy message variant for maximum performance
Uses static references to avoid allocations entirely
Variants§
Text(&'static str)
Text message using static string slice
Binary(&'static [u8])
Binary message using static byte slice
Control
Control message for system operations
Implementations§
§impl StaticMessage
impl StaticMessage
pub const fn text(text: &'static str) -> StaticMessage
pub const fn text(text: &'static str) -> StaticMessage
Create a static text message from a static string slice
pub const fn binary(data: &'static [u8]) -> StaticMessage
pub const fn binary(data: &'static [u8]) -> StaticMessage
Create a static binary message from a static byte slice
pub const fn control(
command: &'static str,
parameters: &'static str,
) -> StaticMessage
pub const fn control( command: &'static str, parameters: &'static str, ) -> StaticMessage
Create a static control message
pub fn into_message(self) -> Message
pub fn into_message(self) -> Message
Convert to full Message (allocates if needed)
pub const fn message_type(&self) -> &'static str
pub const fn message_type(&self) -> &'static str
Get message type as string
pub const fn is_zero_copy(&self) -> bool
pub const fn is_zero_copy(&self) -> bool
Check if this message can be used without allocations
Trait Implementations§
§impl Clone for StaticMessage
impl Clone for StaticMessage
§fn clone(&self) -> StaticMessage
fn clone(&self) -> StaticMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for StaticMessage
impl Debug for StaticMessage
§impl From<&'static [u8]> for StaticMessage
impl From<&'static [u8]> for StaticMessage
§fn from(data: &'static [u8]) -> StaticMessage
fn from(data: &'static [u8]) -> StaticMessage
Converts to this type from the input type.
§impl From<&'static str> for StaticMessage
impl From<&'static str> for StaticMessage
§fn from(text: &'static str) -> StaticMessage
fn from(text: &'static str) -> StaticMessage
Converts to this type from the input type.
§impl PartialEq for StaticMessage
impl PartialEq for StaticMessage
impl Copy for StaticMessage
impl StructuralPartialEq for StaticMessage
Auto Trait Implementations§
impl Freeze for StaticMessage
impl RefUnwindSafe for StaticMessage
impl Send for StaticMessage
impl Sync for StaticMessage
impl Unpin for StaticMessage
impl UnwindSafe for StaticMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more