pub async fn write_frame<T: Serialize, W: AsyncWrite + Unpin>( writer: &mut W, msg: &T, ) -> Result<usize>
Encode and write one frame; returns the frame size written.