Rust solution
rust\nimpl Solution {\n    pub fn subtract_product_and_sum(mut n: i32) -> i32 {\n        let mut sum = 0;\n        let mut product = 1;\n        \n        while
```rust\nimpl Solution {\n    pub fn subtract_product_and_sum(mut n: i32) -> i32 {\n        let mut sum = 0;\n        let mut product = 1;\n        \n        while n > 0 {\n            let d = n % 10;\n            sum += d;\n            product *= d;\n            n /= 10;\n        }\n        \n        product - sum\n    }\n}\n```
[]