pub fn free(&mut self, value: T) {
        assert!(
            value >= T::zero(),
            "tried to free a negative number: {:?}",
            value
        );
        // TODO: we can cheaply check if value > self.last_allocated, so do that.
        if self.last_allocated == Some(value) {
            self.last_allocated = if value > T::zero() {
                Some(value - T::one())
            } else {
                None
            }
        } else {
            self.free_list.push(value);
        }
    }
/// Makes a previously allocated integer available for use.
///
/// Caution: passing an integer not currently allocated will corrupt the state and
/// lead to overlapping allocations.
Makes a previously allocated integer available for use.
Caution: passing an integer not currently allocated will corrupt the state and
lead to overlapping allocations.
Makes a previously allocated integer available for use . Caution : passing an integer not currently allocated will corrupt the state and lead to overlapping allocations .
pub fn free(&mut self, value: T) {
        assert!(
            value >= T::zero(),
            "tried to free a negative number: {:?}",
            value
        );
        // TODO: we can cheaply check if value > self.last_allocated, so do that.
        if self.last_allocated == Some(value) {
            self.last_allocated = if value > T::zero() {
                Some(value - T::one())
            } else {
                None
            }
        } else {
            self.free_list.push(value);
        }
    }
pub fn free ( & mut self , value : T ) { assert ! ( value T zero ( ) " " value ) ; // TODO: we can cheaply check if value > self.last_allocated, so do that. if self . last_allocated == Some ( value ) { self . last_allocated = if value > T :: zero ( ) { Some ( value - T :: one ( ) ) } else { None } } else { self . free_list . push ( value ) ; } }
Makes a previously allocated integer available for use.
Makes a previously allocated integer available for use .
&mut self
value
T