Returns Err once the cap would be exceeded.
(&mut self, chunk: &[u8])
| 35 | |
| 36 | /// Returns Err once the cap would be exceeded. |
| 37 | pub fn append(&mut self, chunk: &[u8]) -> Result<(), u64> { |
| 38 | let new_total = self.bytes.len() as u64 + chunk.len() as u64; |
| 39 | if new_total > self.max_bytes { |
| 40 | return Err(self.max_bytes); |
| 41 | } |
| 42 | self.bytes.extend_from_slice(chunk); |
| 43 | Ok(()) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | /// Connection-keyed map of in-flight restores. |