(&mut self, bytes: &[u8])
| 182 | struct ByteBudget(usize); |
| 183 | impl Write for ByteBudget { |
| 184 | fn write(&mut self, bytes: &[u8]) -> io::Result<usize> { |
| 185 | if bytes.len() > self.0 { |
| 186 | return Err(io::Error::other("operation byte budget exhausted")); |
| 187 | } |
| 188 | self.0 -= bytes.len(); |
| 189 | Ok(bytes.len()) |
| 190 | } |
| 191 | fn flush(&mut self) -> io::Result<()> { |
| 192 | Ok(()) |
| 193 | } |