Add API for extracting the inner payload of RawNetworkMessage
I'd like to take out the `payload` of RawNetworkMessage and then send it to the actual network message processor, but finds there is no way to do it. This commit adds such an API to expose the owned value of inner `payload`.
This commit is contained in:
parent
2cfe0e204d
commit
61565957ad
|
@ -310,6 +310,11 @@ impl RawNetworkMessage {
|
|||
Self { magic, payload, payload_len, checksum }
|
||||
}
|
||||
|
||||
/// Consumes the [RawNetworkMessage] instance and returns the inner payload.
|
||||
pub fn into_payload(self) -> NetworkMessage {
|
||||
self.payload
|
||||
}
|
||||
|
||||
/// The actual message data
|
||||
pub fn payload(&self) -> &NetworkMessage { &self.payload }
|
||||
|
||||
|
|
Loading…
Reference in New Issue