(writer: &mut W, msg: &T)
| 503 | } |
| 504 | |
| 505 | fn write_message<W: Write, T: Serialize>(writer: &mut W, msg: &T) -> io::Result<()> { |
| 506 | let bytes = bincode::serialize(msg).map_err(io::Error::other)?; |
| 507 | let len = |
| 508 | u32::try_from(bytes.len()).map_err(|_| io::Error::other("ipc message exceeds 4 GiB"))?; |
| 509 | writer.write_all(&len.to_le_bytes())?; |
| 510 | writer.write_all(&bytes)?; |
| 511 | Ok(()) |
| 512 | } |
| 513 | |
| 514 | fn slices_eq(a: &[u8], b: &[u8]) -> bool { |
| 515 | if a.len() != b.len() { |
no outgoing calls