pub fn from(header_bytes: &[u8]) -> Result<PayloadInfo, DecoderError> {
		match header_bytes.first().cloned() {
			None => Err(DecoderError::RlpIsTooShort),
			Some(0...0x7f) => Ok(PayloadInfo::new(0, 1)),
			Some(l @ 0x80...0xb7) => Ok(PayloadInfo::new(1, l as usize - 0x80)),
			Some(l @ 0xb8...0xbf) => {
				let len_of_len = l as usize - 0xb7;
				calculate_payload_info(header_bytes, len_of_len)
			}
			Some(l @ 0xc0...0xf7) => Ok(PayloadInfo::new(1, l as usize - 0xc0)),
			Some(l @ 0xf8...0xff) => {
				let len_of_len = l as usize - 0xf7;
				calculate_payload_info(header_bytes, len_of_len)
			},
			// we cant reach this place, but rust requires _ to be implemented
			_ => { unreachable!(); }
		}
	}
/// Create a new object from the given bytes RLP. The bytes
Create a new object from the given bytes RLP. The bytes
Create a new object from the given bytes RLP . The bytes
pub fn from(header_bytes: &[u8]) -> Result<PayloadInfo, DecoderError> {
		match header_bytes.first().cloned() {
			None => Err(DecoderError::RlpIsTooShort),
			Some(0...0x7f) => Ok(PayloadInfo::new(0, 1)),
			Some(l @ 0x80...0xb7) => Ok(PayloadInfo::new(1, l as usize - 0x80)),
			Some(l @ 0xb8...0xbf) => {
				let len_of_len = l as usize - 0xb7;
				calculate_payload_info(header_bytes, len_of_len)
			}
			Some(l @ 0xc0...0xf7) => Ok(PayloadInfo::new(1, l as usize - 0xc0)),
			Some(l @ 0xf8...0xff) => {
				let len_of_len = l as usize - 0xf7;
				calculate_payload_info(header_bytes, len_of_len)
			},
			// we cant reach this place, but rust requires _ to be implemented
			_ => { unreachable!(); }
		}
	}
pub fn from ( header_bytes : & [ u8 ] ) -> Result < PayloadInfo , DecoderError > { match header_bytes . first ( ) . cloned ( ) { None => Err ( DecoderError :: RlpIsTooShort ) , Some ( 0 ... 0x7f ) => Ok ( PayloadInfo :: new ( 0 , 1 ) ) , Some ( l @ 0x80 ... 0xb7 ) => Ok ( PayloadInfo :: new ( 1 , l as usize - 0x80 ) ) , Some ( l @ 0xb8 ... 0xbf ) => { let len_of_len = l as usize - 0xb7 ; calculate_payload_info ( header_bytes , len_of_len ) } Some ( l @ 0xc0 ... 0xf7 ) => Ok ( PayloadInfo :: new ( 1 , l as usize - 0xc0 ) ) , Some ( l @ 0xf8 ... 0xff ) => { let len_of_len = l as usize - 0xf7 ; calculate_payload_info ( header_bytes , len_of_len ) } , // we cant reach this place, but rust requires _ to be implemented _ => { unreachable ! ( ) ; } } }
Create a new object from the given bytes RLP.
Create a new object from the given bytes RLP .
header_bytes
&[u8]