pub enum OffchainMessage {
V0(OffchainMessage),
}
Variants§
V0(OffchainMessage)
Implementations§
Source§impl OffchainMessage
impl OffchainMessage
pub const SIGNING_DOMAIN: &'static [u8] = b"\xffsolana offchain"
pub const HEADER_LEN: usize = 17usize
Sourcepub fn new(version: u8, message: &[u8]) -> Result<Self, SanitizeError>
pub fn new(version: u8, message: &[u8]) -> Result<Self, SanitizeError>
Construct a new OffchainMessage object from the given version and message
Sourcepub fn serialize(&self) -> Result<Vec<u8>, SanitizeError>
pub fn serialize(&self) -> Result<Vec<u8>, SanitizeError>
Serialize the off-chain message to bytes including full header
Sourcepub fn deserialize(data: &[u8]) -> Result<Self, SanitizeError>
pub fn deserialize(data: &[u8]) -> Result<Self, SanitizeError>
Deserialize the off-chain message from bytes that include full header
Sourcepub fn hash(&self) -> Result<Hash, SanitizeError>
pub fn hash(&self) -> Result<Hash, SanitizeError>
Compute the hash of the off-chain message
pub fn get_version(&self) -> u8
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 for OffchainMessage
impl PartialEq for OffchainMessage
impl Eq for OffchainMessage
impl StructuralPartialEq for OffchainMessage
Auto Trait Implementations§
impl Freeze for OffchainMessage
impl RefUnwindSafe for OffchainMessage
impl Send for OffchainMessage
impl Sync for OffchainMessage
impl Unpin for OffchainMessage
impl UnwindSafe for OffchainMessage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more