Struct rlp::Rlp [−][src]
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>
[src][−]
pub const fn new(bytes: &'a [u8]) -> Rlp<'a>
[src]
pub fn as_raw<'view>(&'view self) -> &'a [u8] where
'a: 'view,
[src]
'a: 'view,
pub fn prototype(&self) -> Result<Prototype, DecoderError>
[src]
pub fn payload_info(&self) -> Result<PayloadInfo, DecoderError>
[src]
pub fn data<'view>(&'view self) -> Result<&'a [u8], DecoderError> where
'a: 'view,
[src]
'a: 'view,
pub fn item_count(&self) -> Result<usize, DecoderError>
[src]
pub fn size(&self) -> usize
[src]
pub fn at<'view>(&'view self, index: usize) -> Result<Rlp<'a>, DecoderError> where
'a: 'view,
[src][−]
'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,
[src][−]
&'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
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn is_list(&self) -> bool
[src]
pub fn is_data(&self) -> bool
[src]
pub fn is_int(&self) -> bool
[src]
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,
[src]
Notable traits for RlpIterator<'a, 'view>
impl<'a, 'view> Iterator for RlpIterator<'a, 'view> type Item = Rlp<'a>;
'a: 'view,
pub fn as_val<T>(&self) -> Result<T, DecoderError> where
T: Decodable,
[src]
T: Decodable,
pub fn as_list<T>(&self) -> Result<Vec<T>, DecoderError> where
T: Decodable,
[src]
T: Decodable,
pub fn val_at<T>(&self, index: usize) -> Result<T, DecoderError> where
T: Decodable,
[src]
T: Decodable,
pub fn list_at<T>(&self, index: usize) -> Result<Vec<T>, DecoderError> where
T: Decodable,
[src]
T: Decodable,
pub fn decoder(&self) -> BasicDecoder<'_>
[src]
Trait Implementations
impl<'a> Clone for Rlp<'a>
[src][+]
impl<'a> Debug for Rlp<'a>
[src][+]
impl<'a> Display for Rlp<'a>
[src][+]
impl<'a, 'view> IntoIterator for &'view Rlp<'a> where
'a: 'view,
[src][+]
'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
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src][+]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,