Lines Matching refs:data

14     data: Vec<u8>,  field
21 pub fn new(data: Vec<u8>) -> Self { in new()
22 return Self { data, pos: 0 }; in new()
28 data: Vec::new(), in zerod()
31 result.data.resize(length, 0); in zerod()
37 return &mut self.data; in get_mut()
42 return &self.data; in get_ref()
47 if self.pos >= self.data.len() { in read_u8()
51 return Ok(self.data[self.pos - 1]); in read_u8()
56 if self.pos + 2 > self.data.len() { in read_u16()
60 res |= (self.data[self.pos] as u16) & 0xff; in read_u16()
62 res |= ((self.data[self.pos] as u16) & 0xff) << 8; in read_u16()
70 if self.pos + 4 > self.data.len() { in read_u32()
75 res |= ((self.data[self.pos] as u32) & 0xff) << (8 * i); in read_u32()
84 if self.pos + 8 > self.data.len() { in read_u64()
89 res |= ((self.data[self.pos] as u64) & 0xff) << (8 * i); in read_u64()
103 if self.pos + buf.len() > self.data.len() { in read_exact()
106 buf.copy_from_slice(&self.data[self.pos..self.pos + buf.len()]); in read_exact()
115 if self.pos + size_of_val(buf) > self.data.len() * size_of::<u16>() { in read_u16_into()
137 SeekFrom::SeekEnd(offset) => self.data.len() as i64 + offset, in seek()
143 if pos < 0 || pos > self.data.len() as i64 { in seek()
152 if self.pos >= self.data.len() { in write_u8()
156 self.data[self.pos] = value; in write_u8()
164 if self.pos + 2 > self.data.len() { in write_u16()
168 self.data[self.pos] = (value & 0xff) as u8; in write_u16()
170 self.data[self.pos] = ((value >> 8) & 0xff) as u8; in write_u16()
178 if self.pos + 4 > self.data.len() { in write_u32()
183 self.data[self.pos] = ((value >> (i * 8)) & 0xff) as u8; in write_u32()
192 if self.pos + 8 > self.data.len() { in write_u64()
197 self.data[self.pos] = ((value >> (i * 8)) & 0xff) as u8; in write_u64()
211 if self.pos + buf.len() > self.data.len() { in write_exact()
215 self.data[self.pos..self.pos + buf.len()].copy_from_slice(buf); in write_exact()
223 return &self.data[..]; in as_slice()
228 return &mut self.data[..]; in as_mut_slice()
240 return self.data.len(); in len()