MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / read_message

Function read_message

src/extraction_worker.rs:496–503  ·  view source on GitHub ↗
(reader: &mut R)

Source from the content-addressed store, hash-verified

494// =============================================================================
495
496fn read_message<R: Read, T: for<'de> Deserialize<'de>>(reader: &mut R) -> io::Result<T> {
497 let mut len_buf = [0u8; 4];
498 reader.read_exact(&mut len_buf)?;
499 let len = u32::from_le_bytes(len_buf) as usize;
500 let mut buf = vec![0u8; len];
501 reader.read_exact(&mut buf)?;
502 bincode::deserialize(&buf).map_err(io::Error::other)
503}
504
505fn write_message<W: Write, T: Serialize>(writer: &mut W, msg: &T) -> io::Result<()> {
506 let bytes = bincode::serialize(msg).map_err(io::Error::other)?;

Callers 3

worker_mainFunction · 0.70
round_trip_with_timeoutFunction · 0.70
message_round_tripsFunction · 0.70

Calls

no outgoing calls

Tested by 1

message_round_tripsFunction · 0.56