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.rs
    path of file: ./repos/zenoh/io/zenoh-transport/src/unicast/establishment
    
    the code of the file until where you have to start completion: //
// Copyright (c) 2022 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Co
    
pub(crate) async fn accept_link(link: LinkUnicast, manager: &TransportManager) -> ZResult<()> {
    let mtu = link.get_mtu();
    let is_streamed = link.is_streamed();
    let config = TransportLinkUnicastConfig {
        direction: TransportLinkUnicastDirection::Inbound,
        batch: BatchConfig {
            mtu,
            is_streamed,
            #[cfg(feature = "transport_compression")]
            is_compression: false,
        },
    };
    let mut link = TransportLinkUnicast::new(link, config);
    let mut fsm = AcceptLink {
        link: &mut link,
        prng: &manager.prng,
        cipher: &manager.cipher,
        ext_qos: ext::qos::QoSFsm::new(),
        #[cfg(feature = "shared-memory")]
        ext_shm: ext::shm::ShmFsm::new(&manager.state.unicast.shm),
        #[cfg(feature = "transport_multilink")]
        ext_mlink: manager.state.unicast.multilink.fsm(&manager.prng),
        #[cfg(feature = "transport_auth")]
        ext_auth: manager.state.unicast.authenticator.fsm(&manager.prng),
        ext_lowlatency: ext::lowlatency::LowLatencyFsm::new(),
        #[cfg(feature = "transport_compression")]
        ext_compression: ext::compression::CompressionFsm::new(),
    };

    // Init handshake
    macro_rules! step {
        ($res:expr) => {
            match $res {
                Ok(output) => output,
                Err((e, reason)) => {
                    log::debug!("{}", e);
                    let _ = link.close(reason).await;
                    return Err(e);
                }
            }
        };
    }

    let iack_out = {
        let mut state = State {
            transport: StateTransport {
                batch_size: manager.config.batch_size.min(batch_size::UNICAST).min(mtu),
                resolution: manager.config.resolution,
                ext_qos: ext::qos::StateAccept::new(manager.config.unicast.is_qos),
                #[cfg(feature = "transport_multilink")]
                ext_mlink: manager
                    .state
                    .unicast
                    .multilink
                    .accept(manager.config.unicast.max_links > 1),
                #[cfg(feature = "shared-memory")]
                ext_shm: ext::shm::StateAccept::new(manager.config.unicast.is_shm),
                ext_lowlatency: ext::lowlatency::StateAccept::new(
                    manager.config.unicast.is_lowlatency,
                ),
            },
            #[cfg(any(feature = "transport_auth", feature = "transport_compression"))]
            link: StateLink {
                #[cfg(feature = "transport_auth")]
                ext_auth: manager
                    .state
                    .unicast
                    .authenticator
                    .accept(&mut *zasynclock!(manager.prng)),
                #[cfg(feature = "transport_compression")]
                ext_compression: ext::compression::StateAccept::new(
                    manager.config.unicast.is_compression,
                ),
            },
        };

        // Let's scope the Init phase in such a way memory is freed by Rust
        // after having sent the InitAck. The state will be recovered
        // from the Cookie received in the OpenSyn.
        let isyn_in = RecvInitSynIn {
            mine_version: manager.config.version,
        };
        let isyn_out = step!(fsm.recv_init_syn((&mut state, isyn_in)).await);

        let iack_in = SendInitAckIn {
            mine_version: manager.config.version,
            mine_zid: manager.config.zid,
            mine_whatami: manager.config.whatami,
            other_zid: isyn_out.other_zid,
            other_whatami: isyn_out.other_whatami,
            #[cfg(feature = "shared-memory")]
            ext_shm: isyn_out.ext_shm,
        };
        step!(fsm.send_init_ack((state, iack_in)).await)
    };

    // Open handshake
    let osyn_in = RecvOpenSynIn {
        cookie_nonce: iack_out.cookie_nonce,
    };
    let (mut state, osyn_out) = step!(fsm.recv_open_syn(osyn_in).await);

    // Create the OpenAck but not send it yet
    let oack_in = SendOpenAckIn {
        mine_zid: manager.config.zid,
        mine_lease: manager.config.unicast.lease,
        other_zid: osyn_out.other_zid,
    };
    let oack_out = step!(fsm.send_open_ack((&mut state, oack_in)).await);

    // Initialize the transport
    let config = TransportConfigUnicast {
        zid: osyn_out.other_zid,
        whatami: osyn_out.other_whatami,
        sn_resolution: state.transport.resolution.get(Field::FrameSN),
        tx_initial_sn: oack_out.open_ack.initial_sn,
        is_qos: state.transport.ext_qos.is_qos(),
        #[cfg(feature = "transport_multilink")]
        multilink: state.transport.ext_mlink.multilink(),
        #[cfg(feature = "shared-memory")]
        is_shm: state.transport.ext_shm.is_shm(),
        is_lowlatency: state.transport.ext_lowlatency.is_lowlatency(),
    };

    let a_config = TransportLinkUnicastConfig {
        direction: TransportLinkUnicastDirection::Inbound,
        batch: BatchConfig {
            mtu: state.transport.batch_size,
            is_streamed,
            #[cfg(feature = "transport_compression")]
            is_compression: state.link.ext_compression.is_compression(),
        },
    };
    let a_link = link.reconfigure(a_config);
    let s_link = format!("{:?}", a_link);
    let a_link = LinkUnicastWithOpenAck::new(a_link, Some(oack_out.open_ack));
    let _transport = manager
        .init_transport_unicast(
            config,
            a_link,
            osyn_out.other_initial_sn,
            osyn_out.other_lease,
        )
        .await?;

    log::debug!(
        "New transport link accepted from {} to {}: {}.",
        osyn_out.other_zid,
        manager.config.zid,
        s_link,
    );

    Ok(())
}