rlp payload_info method

This commit is contained in:
debris 2015-12-02 14:14:12 +01:00
parent 35ae32a8a5
commit 356be1c635
1 changed files with 8 additions and 2 deletions

View File

@ -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<PayloadInfo, DecoderError> {
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