Struct common_types::views::ViewRlp
source · [−]pub struct ViewRlp<'a> {
pub rlp: Rlp<'a>,
/* private fields */
}
Expand description
Wrapper for trusted rlp, which is expected to be valid, for use in views When created with view!, records the file and line where it was created for debugging
Fields
rlp: Rlp<'a>
Wrapped Rlp, expected to be valid
Implementations
sourceimpl<'a, 'view> ViewRlp<'a> where
'a: 'view,
impl<'a, 'view> ViewRlp<'a> where
'a: 'view,
sourcepub fn at(&self, index: usize) -> ViewRlp<'a>
pub fn at(&self, index: usize) -> ViewRlp<'a>
Returns rlp at the given index, panics if no rlp at that index
sourcepub fn as_val<T>(&self) -> T where
T: Decodable,
pub fn as_val<T>(&self) -> T where
T: Decodable,
Returns decoded value of this rlp, panics if rlp not valid
sourcepub fn val_at<T>(&self, index: usize) -> T where
T: Decodable,
pub fn val_at<T>(&self, index: usize) -> T where
T: Decodable,
Returns decoded value at the given index, panics not present or valid at that index
sourcepub fn list_at<T>(&self, index: usize) -> Vec<T> where
T: Decodable,
pub fn list_at<T>(&self, index: usize) -> Vec<T> where
T: Decodable,
Returns decoded list of values, panics if rlp is invalid
sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Returns the number of items in the rlp, panics if it is not a list of rlp values
Trait Implementations
sourceimpl<'a, 'view> IntoIterator for &'view ViewRlp<'a> where
'a: 'view,
impl<'a, 'view> IntoIterator for &'view ViewRlp<'a> where
'a: 'view,
Auto Trait Implementations
impl<'a> !RefUnwindSafe for ViewRlp<'a>
impl<'a> Send for ViewRlp<'a>
impl<'a> !Sync for ViewRlp<'a>
impl<'a> Unpin for ViewRlp<'a>
impl<'a> UnwindSafe for ViewRlp<'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