Struct solana_sdk::offchain_message::v0::OffchainMessage
source · pub struct OffchainMessage { /* private fields */ }
Expand description
OffchainMessage Version 0. Struct always contains a non-empty valid message.
Implementations§
source§impl OffchainMessage
impl OffchainMessage
pub const HEADER_LEN: usize = 3usize
pub const MAX_LEN: usize = 65_515usize
pub const MAX_LEN_LEDGER: usize = 1_212usize
sourcepub fn new(message: &[u8]) -> Result<Self, SanitizeError>
pub fn new(message: &[u8]) -> Result<Self, SanitizeError>
Construct a new OffchainMessage object from the given message
sourcepub fn serialize(&self, data: &mut Vec<u8>) -> Result<(), SanitizeError>
pub fn serialize(&self, data: &mut Vec<u8>) -> Result<(), SanitizeError>
Serialize the message to bytes, including the full header
sourcepub fn deserialize(data: &[u8]) -> Result<Self, SanitizeError>
pub fn deserialize(data: &[u8]) -> Result<Self, SanitizeError>
Deserialize the message from bytes that include a full header
sourcepub fn hash(serialized_message: &[u8]) -> Result<Hash, SanitizeError>
pub fn hash(serialized_message: &[u8]) -> Result<Hash, SanitizeError>
Compute the SHA256 hash of the serialized off-chain message
pub fn get_format(&self) -> MessageFormat
pub fn get_message(&self) -> &Vec<u8> ⓘ
Trait Implementations§
source§impl Clone for OffchainMessage
impl Clone for OffchainMessage
source§fn clone(&self) -> OffchainMessage
fn clone(&self) -> OffchainMessage
Returns a copy 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 moresource§impl Debug for OffchainMessage
impl Debug for OffchainMessage
source§impl PartialEq<OffchainMessage> for OffchainMessage
impl PartialEq<OffchainMessage> for OffchainMessage
source§fn eq(&self, other: &OffchainMessage) -> bool
fn eq(&self, other: &OffchainMessage) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.