You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: quic.rs
    path of file: ./repos/phaser/phaser/vendor/rustls/src
    
    the code of the file until where you have to start completion: /// This module contains optional APIs for implementing QUIC TLS.
use crate::client::{ClientConfig, ClientSession, ClientSessionImpl};
use crate::error::TLSError;
use crate::key_schedule::hkdf_expand;
use crate::msgs::enums::{AlertDescription, ContentType, ProtocolVersion};
use crate::msgs::handshake::{ClientExtension, ServerExtension};
use crate::msgs::m
    
fn write_hs(this: &mut SessionCommon, buf: &mut Vec<u8>) -> Option<Keys> {
    while let Some((_, msg)) = this.quic.hs_queue.pop_front() {
        buf.extend_from_slice(&msg);
        if let Some(&(true, _)) = this.quic.hs_queue.front() {
            if this.quic.hs_secrets.is_some() {
                // Allow the caller to switch keys before proceeding.
                break;
            }
        }
    }
    if let Some(secrets) = this.quic.hs_secrets.take() {
        return Some(Keys::new(this.get_suite_assert(), this.is_client, &secrets));
    }
    if let Some(secrets) = this.quic.traffic_secrets.as_ref() {
        if !this.quic.returned_traffic_keys {
            this.quic.returned_traffic_keys = true;
            return Some(Keys::new(this.get_suite_assert(), this.is_client, &secrets));
        }
    }
    None
}