MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / write

Method write

virtio-devices/src/vsock/csm/connection.rs:750–760  ·  view source on GitHub ↗
(&mut self, data: &[u8])

Source from the content-addressed store, hash-verified

748
749 impl Write for TestStream {
750 fn write(&mut self, data: &[u8]) -> IoResult<usize> {
751 match self.write_state {
752 StreamState::Closed => Err(IoError::new(ErrorKind::BrokenPipe, "EPIPE")),
753 StreamState::Error(kind) => Err(IoError::new(kind, "whatevs")),
754 StreamState::Ready => {
755 self.write_buf.extend_from_slice(data);
756 Ok(data.len())
757 }
758 StreamState::WouldBlock => Err(IoError::new(ErrorKind::WouldBlock, "EAGAIN")),
759 }
760 }
761 fn flush(&mut self) -> IoResult<()> {
762 Ok(())
763 }

Callers 2

send_bytes_rawMethod · 0.45
send_bytesMethod · 0.45

Calls 2

newFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected