pub fn write_encryption_algorithm<W: AsyncWrite>(
writer: Pin<&mut W>,
encryption_algorithm: EncryptionAlgorithm,
) -> EncryptionAlgorithmWriter<'_, W>
Expand description
Writes one byte to indicate the encryption algorithm into streams.
ยงExamples
use std::{
io::Result as IOResult,
pin::{
Pin,
pin
}
};
use sheave_core::{
handshake::EncryptionAlgorithm::*,
writers::write_encryption_algorithm
};
#[tokio::main]
async fn main() -> IOResult<()> {
let mut writer: Pin<&mut Vec<u8>> = pin!(Vec::new());
write_encryption_algorithm(writer.as_mut(), NotEncrypted).await?;
assert_eq!(3, writer[0]);
Ok(())
}