pub fn search(&mut self, input: impl Trinary, options: PowOptions) -> Result<Vec<Trit>> {
        let transaction_trits = input.trits();
        let min_weight_magnitude = options.min_weight_magnitude;
        ensure!(
            transaction_trits.len() == TRANSACTION_LENGTH,
            "Transaction length [{}], expected [{}]",
            transaction_trits.len(),
            TRANSACTION_LENGTH
        );
        ensure!(
            min_weight_magnitude <= CURL_HASH_LENGTH,
            "Min Weight Magnitude must be less than {} but it is {}",
            min_weight_magnitude,
            CURL_HASH_LENGTH
        );
        *self.running.write().unwrap() = PearlDiverState::Running;

        let mut mid_state_low = [0; CURL_STATE_LENGTH];
        let mut mid_state_high = [0; CURL_STATE_LENGTH];
        initialize_mid_curl_states(&transaction_trits, &mut mid_state_low, &mut mid_state_high);

        let actual_thread_count = num_cpus::get();
        let threads = if options.threads == 0 {
            1
        } else if options.threads > actual_thread_count {
            actual_thread_count
        } else {
            options.threads
        };

        let (tx, rx) = unbounded();
        crossbeam::scope(|scope| {
            for _ in 0..threads {
                increment(
                    &mut mid_state_low,
                    &mut mid_state_high,
                    162 + CURL_HASH_LENGTH / 9,
                    162 + (CURL_HASH_LENGTH / 9) * 2,
                );
                let local_state_arc = Arc::clone(&self.running);
                let ref_tx_trits = &transaction_trits;
                let tx_clone = tx.clone();
                scope.spawn(move |_| {
                    get_runnable(
                        &local_state_arc,
                        &ref_tx_trits,
                        tx_clone,
                        min_weight_magnitude,
                        mid_state_low,
                        mid_state_high,
                    );
                });
            }
        })
        .unwrap();
        ensure!(
            *self.running.read().unwrap() == PearlDiverState::Completed,
            "Something went wrong."
        );
        let res = rx.recv().unwrap();
        Ok(res)
    }
/// Performs proof of work in place
///
/// * `input` - Anything implementing the Trinary trait
/// * `options` - PoW options
Performs proof of work in place
`input` - Anything implementing the Trinary trait
`options` - PoW options
Performs proof of work in place ` input ` - Anything implementing the Trinary trait ` options ` - PoW options
pub fn search(&mut self, input: impl Trinary, options: PowOptions) -> Result<Vec<Trit>> {
        let transaction_trits = input.trits();
        let min_weight_magnitude = options.min_weight_magnitude;
        ensure!(
            transaction_trits.len() == TRANSACTION_LENGTH,
            "Transaction length [{}], expected [{}]",
            transaction_trits.len(),
            TRANSACTION_LENGTH
        );
        ensure!(
            min_weight_magnitude <= CURL_HASH_LENGTH,
            "Min Weight Magnitude must be less than {} but it is {}",
            min_weight_magnitude,
            CURL_HASH_LENGTH
        );
        *self.running.write().unwrap() = PearlDiverState::Running;
        let mut mid_state_low = [0; CURL_STATE_LENGTH];
        let mut mid_state_high = [0; CURL_STATE_LENGTH];
        initialize_mid_curl_states(&transaction_trits, &mut mid_state_low, &mut mid_state_high);
        let actual_thread_count = num_cpus::get();
        let threads = if options.threads == 0 {
            1
        } else if options.threads > actual_thread_count {
            actual_thread_count
        } else {
            options.threads
        };
        let (tx, rx) = unbounded();
        crossbeam::scope(|scope| {
            for _ in 0..threads {
                increment(
                    &mut mid_state_low,
                    &mut mid_state_high,
                    162 + CURL_HASH_LENGTH / 9,
                    162 + (CURL_HASH_LENGTH / 9) * 2,
                );
                let local_state_arc = Arc::clone(&self.running);
                let ref_tx_trits = &transaction_trits;
                let tx_clone = tx.clone();
                scope.spawn(move |_| {
                    get_runnable(
                        &local_state_arc,
                        &ref_tx_trits,
                        tx_clone,
                        min_weight_magnitude,
                        mid_state_low,
                        mid_state_high,
                    );
                });
            }
        })
        .unwrap();
        ensure!(
            *self.running.read().unwrap() == PearlDiverState::Completed,
            "Something went wrong."
        );
        let res = rx.recv().unwrap();
        Ok(res)
    }
pub fn search ( & mut self , input : impl Trinary , options : PowOptions ) -> Result < Vec < Trit > > { let transaction_trits = input . trits ( ) ; let min_weight_magnitude = options . min_weight_magnitude ; ensure ! ( transaction_trits len ( ) TRANSACTION_LENGTH " " transaction_trits len ( ) TRANSACTION_LENGTH ) ; ensure ! ( min_weight_magnitude CURL_HASH_LENGTH " " min_weight_magnitude CURL_HASH_LENGTH ) ; * self . running . write ( ) . unwrap ( ) = PearlDiverState :: Running ; let mut mid_state_low = [ 0 ; CURL_STATE_LENGTH ] ; let mut mid_state_high = [ 0 ; CURL_STATE_LENGTH ] ; initialize_mid_curl_states ( & transaction_trits , & mut mid_state_low , & mut mid_state_high ) ; let actual_thread_count = num_cpus :: get ( ) ; let threads = if options . threads == 0 { 1 } else if options . threads > actual_thread_count { actual_thread_count } else { options . threads } ; let ( tx , rx ) = unbounded ( ) ; crossbeam :: scope ( | scope | { for _ in 0 .. threads { increment ( & mut mid_state_low , & mut mid_state_high , 162 + CURL_HASH_LENGTH / 9 , 162 + ( CURL_HASH_LENGTH / 9 ) * 2 , ) ; let local_state_arc = Arc :: clone ( & self . running ) ; let ref_tx_trits = & transaction_trits ; let tx_clone = tx . clone ( ) ; scope . spawn ( move | _ | { get_runnable ( & local_state_arc , & ref_tx_trits , tx_clone , min_weight_magnitude , mid_state_low , mid_state_high , ) ; } ) ; } } ) . unwrap ( ) ; ensure ! ( self running read ( ) unwrap ( ) PearlDiverState Completed " " ) ; let res = rx . recv ( ) . unwrap ( ) ; Ok ( res ) }
Performs proof of work in place
 `input` - Anything implementing the Trinary trait
 `options` - PoW options
Performs proof of work in place ` input ` - Anything implementing the Trinary trait ` options ` - PoW options
&mut self
input
impl Trinary
options
PowOptions