From 356be1c635d8817c0ffe54755e8a62d1a5aa7ff6 Mon Sep 17 00:00:00 2001 From: debris Date: Wed, 2 Dec 2015 14:14:12 +0100 Subject: [PATCH] rlp payload_info method --- src/rlp.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rlp.rs b/src/rlp.rs index 67fad0bb0..4c22b7dcc 100644 --- a/src/rlp.rs +++ b/src/rlp.rs @@ -170,6 +170,10 @@ impl<'a, 'view> Rlp<'a> where 'a: 'view { self.rlp.raw() } + pub fn payload_info(&self) -> PayloadInfo { + self.rlp.payload_info().unwrap() + } + pub fn data(&'view self) -> &'a [u8] { self.rlp.data() } @@ -354,6 +358,10 @@ impl<'a, 'view> UntrustedRlp<'a> where 'a: 'view { self.bytes } + pub fn payload_info(&self) -> Result { + BasicDecoder::payload_info(self.bytes) + } + pub fn data(&'view self) -> &'a [u8] { let ii = BasicDecoder::payload_info(self.bytes).unwrap(); &self.bytes[ii.header_len..(ii.header_len + ii.value_len)] @@ -401,8 +409,6 @@ impl<'a, 'view> UntrustedRlp<'a> where 'a: 'view { } } - //pub fn payload_offset(&self) -> - /// Get view onto rlp-slice at index /// /// Caches offset to given index, so access to successive