Struct tetsy_rlp::Rlp[][src]

pub struct Rlp<'a> { /* fields omitted */ }

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]

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]

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]

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]

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]

pub fn as_val<T>(&self) -> Result<T, DecoderError> where
    T: Decodable
[src]

pub fn as_list<T>(&self) -> Result<Vec<T>, DecoderError> where
    T: Decodable
[src]

pub fn val_at<T>(&self, index: usize) -> Result<T, DecoderError> where
    T: Decodable
[src]

pub fn list_at<T>(&self, index: usize) -> Result<Vec<T>, DecoderError> where
    T: Decodable
[src]

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]

type Item = Rlp<'a>

The type of the elements being iterated over.

type IntoIter = RlpIterator<'a, 'view>

Which kind of iterator are we turning this into?

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.