Skip to main content

read_pointer

Function read_pointer 

Source
pub fn read_pointer(pointer: &u8) -> Result<Consumed<u64>>
Expand description

Read a reference pointer encoded as a single byte.

Subtracts the REFERENCE_TAG constant to yield the zero-based index.

§Errors

Returns TypedStreamError::InvalidPointer if the byte is less than REFERENCE_TAG.

§Examples

use crabstep::{deserializer::{read::read_pointer, constants::REFERENCE_TAG}};

let consumed = read_pointer(&0x94).unwrap();

assert_eq!(consumed.value, 2);
assert_eq!(consumed.bytes_consumed, 1);