Lines Matching refs:data
16 data: Vec<u8>, field
23 pub fn new(data: Vec<u8>) -> Self { in new()
24 return Self { data: data, pos: 0 }; in new()
30 data: Vec::new(), in zerod()
33 result.data.resize(length, 0); in zerod()
39 return &mut self.data; in get_mut()
44 return &self.data; in get_ref()
49 if self.pos >= self.data.len() { in read_u8()
53 return Ok(self.data[self.pos - 1]); in read_u8()
58 if self.pos + 2 > self.data.len() { in read_u16()
62 res |= (self.data[self.pos] as u16) & 0xff; in read_u16()
64 res |= ((self.data[self.pos] as u16) & 0xff) << 8; in read_u16()
72 if self.pos + 4 > self.data.len() { in read_u32()
77 res |= ((self.data[self.pos] as u32) & 0xff) << (8 * i); in read_u32()
86 if self.pos + 8 > self.data.len() { in read_u64()
91 res |= ((self.data[self.pos] as u64) & 0xff) << (8 * i); in read_u64()
105 if self.pos + buf.len() > self.data.len() { in read_exact()
108 buf.copy_from_slice(&self.data[self.pos..self.pos + buf.len()]); in read_exact()
117 if self.pos + buf.len() * size_of::<u16>() > self.data.len() * size_of::<u16>() { in read_u16_into()
145 pos = self.data.len() as i64 + offset; in seek()
152 if pos < 0 || pos > self.data.len() as i64 { in seek()
161 if self.pos >= self.data.len() { in write_u8()
165 self.data[self.pos] = value; in write_u8()
173 if self.pos + 2 > self.data.len() { in write_u16()
177 self.data[self.pos] = (value & 0xff) as u8; in write_u16()
179 self.data[self.pos] = ((value >> 8) & 0xff) as u8; in write_u16()
187 if self.pos + 4 > self.data.len() { in write_u32()
192 self.data[self.pos] = ((value >> (i * 8)) & 0xff) as u8; in write_u32()
201 if self.pos + 8 > self.data.len() { in write_u64()
206 self.data[self.pos] = ((value >> (i * 8)) & 0xff) as u8; in write_u64()
220 if self.pos + buf.len() > self.data.len() { in write_exact()
224 self.data[self.pos..self.pos + buf.len()].copy_from_slice(&buf[..]); in write_exact()
232 return &self.data[..]; in as_slice()
237 return &mut self.data[..]; in as_mut_slice()
249 return self.data.len(); in len()