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 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