Rust 0ms 100%
rust\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<
```rust\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 search_bst(root: Option<Rc<RefCell<TreeNode>>>, val: i32) -> Option<Rc<RefCell<TreeNode>>> {\n        match &root {\n            Some(node) if node.borrow().val == val => root,\n            Some(node) if node.borrow().val > val => Solution::search_bst(node.borrow().left.clone(), val),\n            Some(node) if node.borrow().val < val => Solution::search_bst(node.borrow().right.clone(), val),\n            Some(_) => panic!(),\n            None => None,\n        }\n    }\n}\n```\n\nIt\'s not very pretty.
[]