pub fn new(
        file_path: &str,
        topological_path: &str,
        device_information: fidl_fuchsia_hardware_ethernet_ext::EthernetInfo,
    ) -> error::Result<Self> {
        info!("add interface: {} {} {:?}", file_path, topological_path, device_information);
        let mut persisted_interface_config =
            interface::FileBackedConfig::load(&"/data/net_interfaces.cfg.json").unwrap();

        let name = persisted_interface_config
            .get_stable_name(
                &topological_path,
                device_information.mac,
                device_information
                    .features
                    .contains(fidl_fuchsia_hardware_ethernet::Features::Wlan),
            )
            .unwrap();
        // Hardcode the interface metric. Eventually this should
        // be part of the config file.
        let metric = match device_information
            .features
            .contains(fidl_fuchsia_hardware_ethernet::Features::Wlan)
        {
            true => INTF_METRIC_WLAN,
            false => INTF_METRIC_ETH,
        };
        let port = PortDevice {
            name: name.to_string(),
            topological_path: topological_path.to_string(),
            file_path: file_path.to_string(),
            metric,
        };
        Ok(port)
    }
/// Returns a `PortDevice` based on the information passed.
Returns a `PortDevice` based on the information passed.
Returns a ` PortDevice ` based on the information passed .
pub fn new(
        file_path: &str,
        topological_path: &str,
        device_information: fidl_fuchsia_hardware_ethernet_ext::EthernetInfo,
    ) -> error::Result<Self> {
        info!("add interface: {} {} {:?}", file_path, topological_path, device_information);
        let mut persisted_interface_config =
            interface::FileBackedConfig::load(&"/data/net_interfaces.cfg.json").unwrap();
        let name = persisted_interface_config
            .get_stable_name(
                &topological_path,
                device_information.mac,
                device_information
                    .features
                    .contains(fidl_fuchsia_hardware_ethernet::Features::Wlan),
            )
            .unwrap();
        // Hardcode the interface metric. Eventually this should
        // be part of the config file.
        let metric = match device_information
            .features
            .contains(fidl_fuchsia_hardware_ethernet::Features::Wlan)
        {
            true => INTF_METRIC_WLAN,
            false => INTF_METRIC_ETH,
        };
        let port = PortDevice {
            name: name.to_string(),
            topological_path: topological_path.to_string(),
            file_path: file_path.to_string(),
            metric,
        };
        Ok(port)
    }
pub fn new ( file_path : & str , topological_path : & str , device_information : fidl_fuchsia_hardware_ethernet_ext :: EthernetInfo , ) -> error :: Result < Self > { info ! ( " " file_path topological_path device_information ) ; let mut persisted_interface_config = interface :: FileBackedConfig :: load ( & " " ) . unwrap ( ) ; let name = persisted_interface_config . get_stable_name ( & topological_path , device_information . mac , device_information . features . contains ( fidl_fuchsia_hardware_ethernet :: Features :: Wlan ) , ) . unwrap ( ) ; // Hardcode the interface metric. Eventually this should // be part of the config file. let metric = match device_information . features . contains ( fidl_fuchsia_hardware_ethernet :: Features :: Wlan ) { true => INTF_METRIC_WLAN , false => INTF_METRIC_ETH , } ; let port = PortDevice { name : name . to_string ( ) , topological_path : topological_path . to_string ( ) , file_path : file_path . to_string ( ) , metric , } ; Ok ( port ) }
Returns a `PortDevice` based on the information passed.
Returns a ` PortDevice ` based on the information passed .
file_path
&str
topological_path
&str
device_information
fidl_fuchsia_hardware_ethernet_ext::EthernetInfo
file_path
&str
topological_path
&str
device_information
fidl_fuchsia_hardware_ethernet_ext::EthernetInfo