(&mut self)
| 265 | } |
| 266 | |
| 267 | fn read_bytes(&mut self) -> crate::Result<Vec<u8>> { |
| 268 | let len = self.transport.read_varint::<u32>()?; |
| 269 | |
| 270 | if let Some(max_size) = self.config.max_string_size() { |
| 271 | if len as usize > max_size { |
| 272 | return Err(crate::Error::Protocol(ProtocolError::new( |
| 273 | ProtocolErrorKind::SizeLimit, |
| 274 | format!( |
| 275 | "Byte array size {} exceeds maximum allowed size of {}", |
| 276 | len, max_size |
| 277 | ), |
| 278 | ))); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | let mut buf = vec![0u8; len as usize]; |
| 283 | self.transport |
| 284 | .read_exact(&mut buf) |
| 285 | .map_err(From::from) |
| 286 | .map(|_| buf) |
| 287 | } |
| 288 | |
| 289 | fn read_i8(&mut self) -> crate::Result<i8> { |
| 290 | self.read_byte().map(|i| i as i8) |
no test coverage detected