Function write_to_stream

Source
pub fn write_to_stream(
    stream: &mut impl WriteOctetStream,
    connection_id: ConnectionId,
    seed: ConnectionSecretSeed,
    payload: &[u8],
) -> Result<()>
Expand description

Writes a connection header and a payload to the provided stream, including a Murmur3 hash for validation.

§Arguments

  • stream - A mutable reference to a stream implementing WriteOctetStream.
  • connection_id - The ConnectionId to write to the stream.
  • seed - A ConnectionSecretSeed used for generating the Murmur3 hash.
  • payload - The payload data to be written and hashed.

§Errors

Returns an io::Result error if writing to the stream fails.