pub struct Rlp<'a> { /* private fields */ }
Expand description
Data-oriented view onto rlp-slice.
This is an immutable structure. No operations change it.
Should be used in places where, error handling is required, eg. on input
Implementations§
§impl<'a> Rlp<'a>
impl<'a> Rlp<'a>
pub const fn new(bytes: &'a [u8]) -> Rlp<'a>
pub fn as_raw<'view>(&'view self) -> &'a [u8] ⓘwhere
'a: 'view,
pub fn prototype(&self) -> Result<Prototype, DecoderError>
pub fn payload_info(&self) -> Result<PayloadInfo, DecoderError>
pub fn data<'view>(&'view self) -> Result<&'a [u8], DecoderError>where
'a: 'view,
pub fn item_count(&self) -> Result<usize, DecoderError>
pub fn size(&self) -> usize
pub fn at<'view>(&'view self, index: usize) -> Result<Rlp<'a>, DecoderError>where
'a: 'view,
pub fn at<'view>(&'view self, index: usize) -> Result<Rlp<'a>, DecoderError>where
'a: 'view,
Returns an Rlp item in a list at the given index.
Returns an error if this Rlp is not a list or if the index is out of range.
pub fn at_with_offset<'view>(
&'view self,
index: usize
) -> Result<(Rlp<'a>, usize), DecoderError>where
'a: 'view,
pub fn at_with_offset<'view>(
&'view self,
index: usize
) -> Result<(Rlp<'a>, usize), DecoderError>where
'a: 'view,
Returns an Rlp item in a list at the given index along with the byte offset into the raw data slice.
Returns an error if this Rlp is not a list or if the index is out of range.