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: accept_stream.rs
    path of file: ./repos/CYFS/src/component/cyfs-bdt/src/tunnel/builder
    
    the code of the file until where you have to start completion: use log::*;
use std::{
    time::Duration, 
    sync::RwLock, 
    fmt,
    convert::TryFrom
};
use async_std::{task, sync::{Arc, Weak}, future};
use async_trait::{async_trait};
use cyfs_base::*;
use crate::{
    types::*, 
    protocol::{*, v0::*}, 
    interface::*, 
    sn::client::PingClientCalledEvent, 
    stack::{WeakStack, Stack}, 
    tunnel::{self, Tunnel, ProxyType, TunnelContainer},
    stream::{StreamContainer, StreamProviderSelector}
};
use super::{
    action::*, 
    builder::*, 
    proxy::ProxyBuilder
};



struct AcceptPackageStreamImpl {
    builder: WeakAcceptStreamBuilder, 
    remote_id: IncreaseId
}

// 靠编译器推导层次太多
unsafe impl Send for AcceptPackageStreamImpl {}
unsafe impl Sync for AcceptPackageStreamImpl {}

#[derive(Clone)]
struct AcceptPackageStream(Arc<AcceptPackageStreamIm
    
    async fn wait_confirm(&self) -> Result<Arc<ConfirmSynAck>, BuckyError> {
        let (ack, waiter) = {
            let state = &mut *self.0.state.write().unwrap();
            match state {
                AcceptStreamState::Connecting(connecting) => {
                    match &mut connecting.confirm_state {
                        ConfirmState::Confirmed(confirmed) => Ok((Some(confirmed.syn_ack.clone()), None)), 
                        ConfirmState::Unconfirmed(unconfirmed) => Ok((None, Some(unconfirmed.waiter.new_waiter()))) 
                    }      
                },
                _ => {
                    Err(BuckyError::new(BuckyErrorCode::ErrorState, "builder not connecting"))
                }          
            }
        }?;
        if let Some(ack) = ack {
            Ok(ack)
        } else {
            StateWaiter::wait(waiter.unwrap(), | | self.confirm_syn_ack()).await.ok_or_else(| | BuckyError::new(BuckyErrorCode::ErrorState, "builder not connecting"))
        }
    }