pub struct Message {
pub channel: u64,
pub typ: u8,
pub message: Vec<u8>,
}
Expand description
A SMC message.
Fields§
§channel: u64
§typ: u8
§message: Vec<u8>
Implementations§
Source§impl Message
impl Message
Sourcepub fn new(channel: u64, typ: u8, message: Vec<u8>) -> Message
pub fn new(channel: u64, typ: u8, message: Vec<u8>) -> Message
Create a new message.
Examples found in repository?
More examples
examples/tcp.rs (line 100)
97async fn handle_outgoing(stream: TcpStream) -> Result<()> {
98 let (mut reader, mut writer) = create_from_stream(stream);
99
100 let hello_msg = Message::new(1, 1, "hi".as_bytes().to_vec());
101 writer.send(hello_msg).await?;
102
103 while let Some(msg) = reader.try_next().await? {
104 eprintln!("received: {}", format_msg(&msg));
105 }
106
107 Ok(())
108}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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