[Rust] recursive solution
\n// Definition for a binary tree node.\n// #[derive(Debug, PartialEq, Eq)]\n// pub struct TreeNode {\n//   pub val: i32,\n//   pub left: Option<Rc<RefCell<Tree
```\n// Definition for a binary tree node.\n// #[derive(Debug, PartialEq, Eq)]\n// pub struct TreeNode {\n//   pub val: i32,\n//   pub left: Option<Rc<RefCell<TreeNode>>>,\n//   pub right: Option<Rc<RefCell<TreeNode>>>,\n// }\n// \n// impl TreeNode {\n//   #[inline]\n//   pub fn new(val: i32) -> Self {\n//     TreeNode {\n//       val,\n//       left: None,\n//       right: None\n//     }\n//   }\n// }\nuse std::rc::Rc;\nuse std::cell::RefCell;\nimpl Solution {\n    pub fn range_sum_bst(root: Option<Rc<RefCell<TreeNode>>>, l: i32, r: i32) -> i32 {\n        if let Some(root) = root {\n            let mut sum = 0;\n            if l <= root.borrow().val && root.borrow().val <=r {\n                sum += root.borrow().val;\n            }\n            \n            if l < root.borrow().val {\n                sum += Self::range_sum_bst(root.borrow().left.clone(), l, r);\n            }\n            \n            if r > root.borrow().val {\n                sum += Self::range_sum_bst(root.borrow().right.clone(), l, r);\n            }\n            return sum;\n        }\n        return 0;\n    }\n}\n```
[]