pub struct SailsMessageHeader { /* private fields */ }Expand description
Sails message header.
The header is a feature of an IDLv2. It gives opportunity for on top of blockchain services to trace sails messages and programs.
Implementations§
Source§impl SailsMessageHeader
impl SailsMessageHeader
Sourcepub const fn new(
version: Version,
hlen: HeaderLength,
interface_id: InterfaceId,
route_id: u8,
entry_id: u16,
) -> Self
pub const fn new( version: Version, hlen: HeaderLength, interface_id: InterfaceId, route_id: u8, entry_id: u16, ) -> Self
Creates a new Sails message header.
pub const fn v1(interface_id: InterfaceId, entry_id: u16, route_id: u8) -> Self
Sourcepub const fn hlen(&self) -> HeaderLength
pub const fn hlen(&self) -> HeaderLength
Gets the header length.
Sourcepub const fn interface_id(&self) -> InterfaceId
pub const fn interface_id(&self) -> InterfaceId
Gets the interface ID.
Source§impl SailsMessageHeader
impl SailsMessageHeader
Sourcepub fn try_read_bytes(bytes: &mut &[u8]) -> Result<Self, &'static str>
pub fn try_read_bytes(bytes: &mut &[u8]) -> Result<Self, &'static str>
Deserialize header from bytes advancing the slice.
Sourcepub fn try_from_bytes(bytes: &[u8]) -> Result<Self, &'static str>
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self, &'static str>
Deserialize header from bytes (expects magic bytes at the start) without mutating the input.
Sourcepub fn try_match_interfaces(
self,
interfaces: &[(InterfaceId, u8)],
) -> Result<MatchedInterface, &'static str>
pub fn try_match_interfaces( self, interfaces: &[(InterfaceId, u8)], ) -> Result<MatchedInterface, &'static str>
Tries to match the header’s interface ID and route ID against a list of known interfaces in the program.
If the header has route_id == 0 and exactly one interface ID match exists, the returned MatchedInterface uses the program’s route_id for that interface.
Trait Implementations§
Source§impl Clone for SailsMessageHeader
impl Clone for SailsMessageHeader
Source§fn clone(&self) -> SailsMessageHeader
fn clone(&self) -> SailsMessageHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SailsMessageHeader
impl Debug for SailsMessageHeader
Source§impl Decode for SailsMessageHeader
impl Decode for SailsMessageHeader
Source§fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
fn decode<I: Input>(input: &mut I) -> Result<Self, Error>
Attempt to deserialise the value from input.
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl Encode for SailsMessageHeader
impl Encode for SailsMessageHeader
Source§fn encode_to<O: Output + ?Sized>(&self, dest: &mut O)
fn encode_to<O: Output + ?Sized>(&self, dest: &mut O)
Convert self to a slice and append it to the destination.
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
Source§impl PartialEq for SailsMessageHeader
impl PartialEq for SailsMessageHeader
Source§fn eq(&self, other: &SailsMessageHeader) -> bool
fn eq(&self, other: &SailsMessageHeader) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for SailsMessageHeader
impl StructuralPartialEq for SailsMessageHeader
Auto Trait Implementations§
impl Freeze for SailsMessageHeader
impl RefUnwindSafe for SailsMessageHeader
impl Send for SailsMessageHeader
impl Sync for SailsMessageHeader
impl Unpin for SailsMessageHeader
impl UnsafeUnpin for SailsMessageHeader
impl UnwindSafe for SailsMessageHeader
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