pub fn new(config: Config, stream: BufStream<TcpStream>) -> Worker {
        let mut rng = thread_rng();
        let connection_id: String = iter::repeat(())
            .map(|()| rng.sample(Alphanumeric))
            .take(16)
            .collect();
        let uuid = format!("{}-{}", 0, connection_id.clone());
        Worker {
            user_id: 0, // We dont know until the user logs in
            connection_id: connection_id,
            login: None,
            config: config.clone(),
            stream: stream,
            protocol: StratumProtocol::new(),
            error: false,
            authenticated: false,
            status: WorkerStatus::new(uuid.clone()),
            worker_shares: WorkerShares::new(uuid.clone()),
            shares: Vec::new(),
            request_ids: queue![],
            needs_job: false,
            requested_job: false,
            redis: None,
            buffer: String::with_capacity(4096),
        }
    }
/// Creates a new Stratum Worker.
Creates a new Stratum Worker.
Creates a new Stratum Worker .
pub fn new(config: Config, stream: BufStream<TcpStream>) -> Worker {
        let mut rng = thread_rng();
        let connection_id: String = iter::repeat(())
            .map(|()| rng.sample(Alphanumeric))
            .take(16)
            .collect();
        let uuid = format!("{}-{}", 0, connection_id.clone());
        Worker {
            user_id: 0, // We dont know until the user logs in
            connection_id: connection_id,
            login: None,
            config: config.clone(),
            stream: stream,
            protocol: StratumProtocol::new(),
            error: false,
            authenticated: false,
            status: WorkerStatus::new(uuid.clone()),
            worker_shares: WorkerShares::new(uuid.clone()),
            shares: Vec::new(),
            request_ids: queue![],
            needs_job: false,
            requested_job: false,
            redis: None,
            buffer: String::with_capacity(4096),
        }
    }
pub fn new ( config : Config , stream : BufStream < TcpStream > ) -> Worker { let mut rng = thread_rng ( ) ; let connection_id : String = iter :: repeat ( ( ) ) . map ( | ( ) | rng . sample ( Alphanumeric ) ) . take ( 16 ) . collect ( ) ; let uuid = format ! ( " " 0 connection_id clone ( ) ) ; Worker { user_id : 0 , // We dont know until the user logs in connection_id : connection_id , login : None , config : config . clone ( ) , stream : stream , protocol : StratumProtocol :: new ( ) , error : false , authenticated : false , status : WorkerStatus :: new ( uuid . clone ( ) ) , worker_shares : WorkerShares :: new ( uuid . clone ( ) ) , shares : Vec :: new ( ) , request_ids : queue ! [ ] , needs_job : false , requested_job : false , redis : None , buffer : String :: with_capacity ( 4096 ) , } }
Creates a new Stratum Worker.
Creates a new Stratum Worker .
config
Config
stream
BufStream<TcpStream>