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
sourceimpl<'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]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [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>ⓘNotable traits for RlpIterator<'a, 'view>impl<'a, 'view> Iterator for RlpIterator<'a, 'view> type Item = Rlp<'a>;
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
sourceimpl<'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> !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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more