(&mut self, buf: &[u8])
| 2378 | |
| 2379 | impl Write for BioStream { |
| 2380 | fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> { |
| 2381 | // Write to outgoing MemoryBIO |
| 2382 | unsafe { |
| 2383 | let nbytes = sys::BIO_write( |
| 2384 | self.outbio.bio, |
| 2385 | buf.as_ptr() as *const _, |
| 2386 | buf.len().min(i32::MAX as usize) as i32, |
| 2387 | ); |
| 2388 | if nbytes < 0 { |
| 2389 | return Err(std::io::Error::other("BIO write failed")); |
| 2390 | } |
| 2391 | Ok(nbytes as usize) |
| 2392 | } |
| 2393 | } |
| 2394 | |
| 2395 | fn flush(&mut self) -> std::io::Result<()> { |
| 2396 | // MemoryBIO doesn't need flushing |
no test coverage detected