Question: We are using default DOF grids to present the data in the database. We are using this function out of the box and we are doing only the required xml configuration.

In some cases, the tables contain several hundred thousand records and the DOF grid does not show any data, it shows only empty page, although it has to load only 400 records (by default) on the page.

We tryed to find a configuration parameter which can be related to this behavior, but without success, and we have no more options, since we are limited to the configuration in this case.

We were not able to find any particular reason for this behavior, or any good resolution of this problem.

Answer: 
The error is because Rust did not infer the type you expected.

In your code, the type of `value` is inferred to be `&i32` because `input` is a reference of a element in `inputs`, and you `push` a `value` later, therefore the type of `stack` is inferred to be `Vec<&i32>`.

A best fix is to explicitly specify the type of stack:

```rust
let mut stack: Vec<i32> = Vec::new();

```

And because `i32` has implemented `Copy` trait, you should never need to clone a `i32` value, if it is a reference, just dereference it.

Fixed code:

```rust
#[derive(Debug)]
pub enum CalculatorInput {
    Add,
    Subtract,
    Multiply,
    Divide,
    Value(i32),
}

pub fn evaluate(inputs: &[CalculatorInput]) -> Option<i32> {
    let mut stack: Vec<i32> = Vec::new();

    for input in inputs {
        match input {
            CalculatorInput::Value(value) => {
                stack.push(*value);
            }
            operator => {
                if stack.len() < 2 {
                    return None;
                }
                let second = stack.pop().unwrap();
                let first = stack.pop().unwrap();
                let result = match operator {
                    CalculatorInput::Add => first + second,
                    CalculatorInput::Subtract => first - second,
                    CalculatorInput::Multiply => first * second,
                    CalculatorInput::Divide => first / second,
                    CalculatorInput::Value(_) => return None,
                };
                stack.push(result);
            }
        }
    }
    if stack.len() != 1 {
        None
    } else {
        Some(stack.pop().unwrap())
    }
}

```
You have the same behavior with this simple exemple

```
fn main() {
    let mut stack = Vec::new();

    let a = String::from("test");
    stack.push(&a.clone());
    //-------- ^

    println!("{:?}", stack);
}

```

and the good way is to not borrow when clone.

```
fn main() {
    let mut stack = Vec::new();

    let a = String::from("test");
    stack.push(a.clone());
    //-------- ^

    println!("{:?}", stack);
}

```

The variable should be used like this `stack.push(result.clone());` and change code like this

```
pub fn evaluate(inputs: &[CalculatorInput]) -> Option<i32> {
    let mut stack: Vec<i32> = Vec::new();
    //---------------- ^
    for input in inputs {
        match input {
            CalculatorInput::Value(value) => {
                stack.push(value.clone());
               //----------------- ^
            },
            operator => {
                if stack.len() < 2 {
                    return None;
                }
                let second = stack.pop().unwrap();
                let first = stack.pop().unwrap();
                let result = match operator {
                  CalculatorInput::Add => first + second,
                  CalculatorInput::Subtract => first - second,
                  CalculatorInput::Multiply => first * second,
                  CalculatorInput::Divide => first / second,
                  CalculatorInput::Value(_) => return None,
                };

                stack.push(result.clone());
                        //-^
            }
        }
    }
    if stack.len() != 1 {
        None
    } else {
        Some(stack.pop().unwrap())
    //------- ^
    }
}

```