pub fn try_consume(&mut self, tokens_required: usize) -> bool {
        debug_assert!(tokens_required <= UNLIMITED);
        self.refill();
        let possible = self.current_size >= tokens_required;
        if possible {
            self.current_size -= tokens_required;
        } else if tokens_required == UNLIMITED {
            self.current_size = 0;
        }

        // Keep track of smallest observed bucket size so burst size can be computed (for tests and stats)
        self.smallest_size = std::cmp::min(self.smallest_size, self.current_size);

        possible || self.refill_rate == UNLIMITED
    }
/**
     * Determine if an operation of cost \p tokens_required_a is possible, and deduct from the
     * bucket if that's the case.
     * The default cost is 1 token, but resource intensive operations may request
     * more tokens to be available.
     */
Determine if an operation of cost \p tokens_required_a is possible, and deduct from the
bucket if that's the case.
The default cost is 1 token, but resource intensive operations may request
more tokens to be available.
Determine if an operation of cost \ p tokens_required_a is possible and deduct from the bucket if that ' s the case . The default cost is 1 token but resource intensive operations may request more tokens to be available .
pub fn try_consume(&mut self, tokens_required: usize) -> bool {
        debug_assert!(tokens_required <= UNLIMITED);
        self.refill();
        let possible = self.current_size >= tokens_required;
        if possible {
            self.current_size -= tokens_required;
        } else if tokens_required == UNLIMITED {
            self.current_size = 0;
        }
        // Keep track of smallest observed bucket size so burst size can be computed (for tests and stats)
        self.smallest_size = std::cmp::min(self.smallest_size, self.current_size);
        possible || self.refill_rate == UNLIMITED
    }
pub fn try_consume ( & mut self , tokens_required : usize ) -> bool { debug_assert ! ( tokens_required UNLIMITED ) ; self . refill ( ) ; let possible = self . current_size >= tokens_required ; if possible { self . current_size -= tokens_required ; } else if tokens_required == UNLIMITED { self . current_size = 0 ; } // Keep track of smallest observed bucket size so burst size can be computed (for tests and stats) self . smallest_size = std :: cmp :: min ( self . smallest_size , self . current_size ) ; possible || self . refill_rate == UNLIMITED }
Determine if an operation of cost \p tokens_required_a is possible, and deduct from the
 bucket if that's the case.
Determine if an operation of cost \ p tokens_required_a is possible and deduct from the bucket if that ' s the case .
&mut self
tokens_required
usize
&mut self
tokens_required
usize