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§
source§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
sourcepub 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.
sourcepub 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.
pub fn is_null(&self) -> bool
pub fn is_empty(&self) -> bool
pub fn is_list(&self) -> bool
pub fn is_data(&self) -> bool
pub fn is_int(&self) -> bool
pub fn iter<'view>(&'view self) -> RlpIterator<'a, 'view> ⓘwhere
'a: 'view,
pub fn as_val<T>(&self) -> Result<T, DecoderError>where
T: Decodable,
pub fn as_list<T>(&self) -> Result<Vec<T>, DecoderError>where
T: Decodable,
pub fn val_at<T>(&self, index: usize) -> Result<T, DecoderError>where
T: Decodable,
pub fn list_at<T>(&self, index: usize) -> Result<Vec<T>, DecoderError>where
T: Decodable,
pub fn decoder(&self) -> BasicDecoder<'_>
Trait Implementations§
source§impl<'a, 'view> IntoIterator for &'view Rlp<'a>where
'a: 'view,
impl<'a, 'view> IntoIterator for &'view Rlp<'a>where
'a: 'view,
Auto Trait Implementations§
impl<'a> !Freeze for Rlp<'a>
impl<'a> !RefUnwindSafe for Rlp<'a>
impl<'a> Send for Rlp<'a>
impl<'a> !Sync for Rlp<'a>
impl<'a> Unpin for Rlp<'a>
impl<'a> UnwindSafe for Rlp<'a>
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)