OKEE
1
I have very simple struct:
struct WSReadFrame {
opcode: u8,
payload: Vec<u8>,
}
In code I need to send it via crossbeam_channel::bounded like so
let (s, r) = bounded::<WSReadFrame>(1024);
...
let send_frame: WSReadFrame = WSReadFrame::new(...);
s.send(send_frame).unwrap();
What I don't get in this snippet is that what will actually happen:
-
send_frame will be moved and only its pointer will actually be sent over the channel, and no bytes will be copied?
- during send rust will move send_frame and actually send all its content?
kornel
2
Pairs of send/recv are analogous to vec.push()
and vec.pop()
.
2 Likes
OKEE
3
So it will send only pointer, right ?
alice
4
Only the opcode, as well as the pointer, length and capacity of the vector are actually copied. The contents behind the pointer is not.
2 Likes
system
Closed
5
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.