pub fn create_worker(self, logger: Logger) -> Result<Worker, MeshSimError> {
        //Create the RNG
        let gen = Worker::rng_from_seed(self.random_seed);
        //Check if a worker_id is present
        let id = match self.worker_id {
            Some(id) => id,
            None => WorkerConfig::gen_id(self.random_seed),
        };
        //Wrap the rng in the shared-mutable-state smart pointers
        let rng = Arc::new(Mutex::new(gen));
        let protocol = self.protocol.expect("A protocol must be specified");

        //Create the radios
        let sr_channels = match self.radio_short {
            Some(sr_config) => {
                let (sr, listener) = sr_config.create_radio(
                    self.operation_mode,
                    RadioTypes::ShortRange,
                    self.work_dir.clone(),
                    self.worker_name.clone(),
                    id.clone(),
                    self.random_seed,
                    Some(Arc::clone(&rng)),
                    logger.clone(),
                )?;
                Some((sr, listener))
            }
            None => None,
        };

        let lr_channels = match self.radio_long {
            Some(lr_config) => {
                let (lr, listener) = lr_config.create_radio(
                    self.operation_mode,
                    RadioTypes::LongRange,
                    self.work_dir.clone(),
                    self.worker_name.clone(),
                    id.clone(),
                    self.random_seed,
                    Some(Arc::clone(&rng)),
                    logger.clone(),
                )?;
                Some((lr, listener))
            }
            None => None,
        };

        // //Need to add an endline char to stdout after both radios have been initialized.
        // println!();

        Worker::new(
            self.worker_name,
            sr_channels,
            lr_channels,
            self.work_dir,
            Arc::clone(&rng),
            self.random_seed,
            self.operation_mode,
            id,
            protocol,
            self.packet_queue_size.unwrap_or(DEFAULT_PACKET_QUEUE_SIZE),
            self.stale_packet_threshold.unwrap_or(DEFAULT_STALE_PACKET_THRESHOLD),
            self.position,
            Some(self.velocity),
            self.destination,
            logger,
        )
    }
///Creates a new Worker object configured with the values of this configuration object.
Creates a new Worker object configured with the values of this configuration object.
Creates a new Worker object configured with the values of this configuration object .
pub fn create_worker(self, logger: Logger) -> Result<Worker, MeshSimError> {
        //Create the RNG
        let gen = Worker::rng_from_seed(self.random_seed);
        //Check if a worker_id is present
        let id = match self.worker_id {
            Some(id) => id,
            None => WorkerConfig::gen_id(self.random_seed),
        };
        //Wrap the rng in the shared-mutable-state smart pointers
        let rng = Arc::new(Mutex::new(gen));
        let protocol = self.protocol.expect("A protocol must be specified");
        //Create the radios
        let sr_channels = match self.radio_short {
            Some(sr_config) => {
                let (sr, listener) = sr_config.create_radio(
                    self.operation_mode,
                    RadioTypes::ShortRange,
                    self.work_dir.clone(),
                    self.worker_name.clone(),
                    id.clone(),
                    self.random_seed,
                    Some(Arc::clone(&rng)),
                    logger.clone(),
                )?;
                Some((sr, listener))
            }
            None => None,
        };
        let lr_channels = match self.radio_long {
            Some(lr_config) => {
                let (lr, listener) = lr_config.create_radio(
                    self.operation_mode,
                    RadioTypes::LongRange,
                    self.work_dir.clone(),
                    self.worker_name.clone(),
                    id.clone(),
                    self.random_seed,
                    Some(Arc::clone(&rng)),
                    logger.clone(),
                )?;
                Some((lr, listener))
            }
            None => None,
        };
        // //Need to add an endline char to stdout after both radios have been initialized.
        // println!();
        Worker::new(
            self.worker_name,
            sr_channels,
            lr_channels,
            self.work_dir,
            Arc::clone(&rng),
            self.random_seed,
            self.operation_mode,
            id,
            protocol,
            self.packet_queue_size.unwrap_or(DEFAULT_PACKET_QUEUE_SIZE),
            self.stale_packet_threshold.unwrap_or(DEFAULT_STALE_PACKET_THRESHOLD),
            self.position,
            Some(self.velocity),
            self.destination,
            logger,
        )
    }
pub fn create_worker ( self , logger : Logger ) -> Result < Worker , MeshSimError > { //Create the RNG let gen = Worker :: rng_from_seed ( self . random_seed ) ; //Check if a worker_id is present let id = match self . worker_id { Some ( id ) => id , None => WorkerConfig :: gen_id ( self . random_seed ) , } ; //Wrap the rng in the shared-mutable-state smart pointers let rng = Arc :: new ( Mutex :: new ( gen ) ) ; let protocol = self . protocol . expect ( " " ) ; //Create the radios let sr_channels = match self . radio_short { Some ( sr_config ) => { let ( sr , listener ) = sr_config . create_radio ( self . operation_mode , RadioTypes :: ShortRange , self . work_dir . clone ( ) , self . worker_name . clone ( ) , id . clone ( ) , self . random_seed , Some ( Arc :: clone ( & rng ) ) , logger . clone ( ) , ) ? ; Some ( ( sr , listener ) ) } None => None , } ; let lr_channels = match self . radio_long { Some ( lr_config ) => { let ( lr , listener ) = lr_config . create_radio ( self . operation_mode , RadioTypes :: LongRange , self . work_dir . clone ( ) , self . worker_name . clone ( ) , id . clone ( ) , self . random_seed , Some ( Arc :: clone ( & rng ) ) , logger . clone ( ) , ) ? ; Some ( ( lr , listener ) ) } None => None , } ; // //Need to add an endline char to stdout after both radios have been initialized. // println!(); Worker :: new ( self . worker_name , sr_channels , lr_channels , self . work_dir , Arc :: clone ( & rng ) , self . random_seed , self . operation_mode , id , protocol , self . packet_queue_size . unwrap_or ( DEFAULT_PACKET_QUEUE_SIZE ) , self . stale_packet_threshold . unwrap_or ( DEFAULT_STALE_PACKET_THRESHOLD ) , self . position , Some ( self . velocity ) , self . destination , logger , ) }
Creates a new Worker object configured with the values of this configuration object.
Creates a new Worker object configured with the values of this configuration object .
self
logger
Logger