pub fn push_worker(&mut self, worker: WorkerType) -> Result<(), String> {
        // note: not allow block flag duplicate
        for thread in self.reserve.iter().chain(self.threads.iter()) {
            if thread.get_flag() == worker.get_flag() {
                return Err(format!("already mining thread exist: {}", thread.get_info()));
            }
        }
        self.threads.push(worker);
        Ok(())
    }
/// add new worker.
/// return error if already pushed same block flag worker.
add new worker.
return error if already pushed same block flag worker.
add new worker . return error if already pushed same block flag worker .
pub fn push_worker(&mut self, worker: WorkerType) -> Result<(), String> {
        // note: not allow block flag duplicate
        for thread in self.reserve.iter().chain(self.threads.iter()) {
            if thread.get_flag() == worker.get_flag() {
                return Err(format!("already mining thread exist: {}", thread.get_info()));
            }
        }
        self.threads.push(worker);
        Ok(())
    }
pub fn push_worker ( & mut self , worker : WorkerType ) -> Result < ( ) , String > { // note: not allow block flag duplicate for thread in self . reserve . iter ( ) . chain ( self . threads . iter ( ) ) { if thread . get_flag ( ) == worker . get_flag ( ) { return Err ( format ! ( " " thread get_info ( ) ) ) ; } } self . threads . push ( worker ) ; Ok ( ( ) ) }
add new worker.
add new worker .
&mut self
worker
WorkerType
&mut self
worker
WorkerType