pub fn create_net(cfg: NetworkInterfaceConfig) -> Result<Net> {
        let rx_rate_limiter = cfg
            .rx_rate_limiter
            .map(super::RateLimiterConfig::try_into)
            .transpose()
            .map_err(NetworkInterfaceError::CreateRateLimiter)?;
        let tx_rate_limiter = cfg
            .tx_rate_limiter
            .map(super::RateLimiterConfig::try_into)
            .transpose()
            .map_err(NetworkInterfaceError::CreateRateLimiter)?;

        // Create and return the Net device
        devices::virtio::net::Net::new_with_tap(
            cfg.iface_id,
            cfg.host_dev_name.clone(),
            cfg.guest_mac.as_ref(),
            rx_rate_limiter.unwrap_or_default(),
            tx_rate_limiter.unwrap_or_default(),
            cfg.allow_mmds_requests,
        )
        .map_err(NetworkInterfaceError::CreateNetworkDevice)
    }
/// Creates a Net device from a NetworkInterfaceConfig.
Creates a Net device from a NetworkInterfaceConfig.
Creates a Net device from a NetworkInterfaceConfig .
pub fn create_net(cfg: NetworkInterfaceConfig) -> Result<Net> {
        let rx_rate_limiter = cfg
            .rx_rate_limiter
            .map(super::RateLimiterConfig::try_into)
            .transpose()
            .map_err(NetworkInterfaceError::CreateRateLimiter)?;
        let tx_rate_limiter = cfg
            .tx_rate_limiter
            .map(super::RateLimiterConfig::try_into)
            .transpose()
            .map_err(NetworkInterfaceError::CreateRateLimiter)?;
        // Create and return the Net device
        devices::virtio::net::Net::new_with_tap(
            cfg.iface_id,
            cfg.host_dev_name.clone(),
            cfg.guest_mac.as_ref(),
            rx_rate_limiter.unwrap_or_default(),
            tx_rate_limiter.unwrap_or_default(),
            cfg.allow_mmds_requests,
        )
        .map_err(NetworkInterfaceError::CreateNetworkDevice)
    }
pub fn create_net ( cfg : NetworkInterfaceConfig ) -> Result < Net > { let rx_rate_limiter = cfg . rx_rate_limiter . map ( super :: RateLimiterConfig :: try_into ) . transpose ( ) . map_err ( NetworkInterfaceError :: CreateRateLimiter ) ? ; let tx_rate_limiter = cfg . tx_rate_limiter . map ( super :: RateLimiterConfig :: try_into ) . transpose ( ) . map_err ( NetworkInterfaceError :: CreateRateLimiter ) ? ; // Create and return the Net device devices :: virtio :: net :: Net :: new_with_tap ( cfg . iface_id , cfg . host_dev_name . clone ( ) , cfg . guest_mac . as_ref ( ) , rx_rate_limiter . unwrap_or_default ( ) , tx_rate_limiter . unwrap_or_default ( ) , cfg . allow_mmds_requests , ) . map_err ( NetworkInterfaceError :: CreateNetworkDevice ) }
Creates a Net device from a NetworkInterfaceConfig.
Creates a Net device from a NetworkInterfaceConfig .
cfg
NetworkInterfaceConfig
cfg
NetworkInterfaceConfig