Lines Matching refs:data
13 data: Vec<u8>, field
20 pub fn new(data: Vec<u8>) -> Self { in new()
21 return Self { data: data, pos: 0 }; in new()
27 data: Vec::new(), in zerod()
30 result.data.resize(length, 0); in zerod()
36 return &mut self.data; in get_mut()
41 return &self.data; in get_ref()
46 if self.pos >= self.data.len() { in read_u8()
50 return Ok(self.data[self.pos - 1]); in read_u8()
55 if self.pos + 2 > self.data.len() { in read_u16()
59 res |= (self.data[self.pos] as u16) & 0xff; in read_u16()
61 res |= ((self.data[self.pos] as u16) & 0xff) << 8; in read_u16()
69 if self.pos + 4 > self.data.len() { in read_u32()
74 res |= ((self.data[self.pos] as u32) & 0xff) << (8 * i); in read_u32()
83 if self.pos + 8 > self.data.len() { in read_u64()
88 res |= ((self.data[self.pos] as u64) & 0xff) << (8 * i); in read_u64()
102 if self.pos + buf.len() > self.data.len() { in read_exact()
105 buf.copy_from_slice(&self.data[self.pos..self.pos + buf.len()]); in read_exact()
114 if self.pos + buf.len() * size_of::<u16>() > self.data.len() * size_of::<u16>() { in read_u16_into()
142 pos = self.data.len() as i64 + offset; in seek()
149 if pos < 0 || pos > self.data.len() as i64 { in seek()
158 if self.pos >= self.data.len() { in write_u8()
162 self.data[self.pos] = value; in write_u8()
170 if self.pos + 2 > self.data.len() { in write_u16()
174 self.data[self.pos] = (value & 0xff) as u8; in write_u16()
176 self.data[self.pos] = ((value >> 8) & 0xff) as u8; in write_u16()
184 if self.pos + 4 > self.data.len() { in write_u32()
189 self.data[self.pos] = ((value >> (i * 8)) & 0xff) as u8; in write_u32()
198 if self.pos + 8 > self.data.len() { in write_u64()
203 self.data[self.pos] = ((value >> (i * 8)) & 0xff) as u8; in write_u64()
217 if self.pos + buf.len() > self.data.len() { in write_exact()
221 self.data[self.pos..self.pos + buf.len()].copy_from_slice(&buf[..]); in write_exact()
229 return &self.data[..]; in as_slice()
234 return &mut self.data[..]; in as_mut_slice()
246 return self.data.len(); in len()