leetcode_test_utils/tree/
template.rs

1//! The string presentations of definitions on leetcode. These variables will be helpful for preparing
2//! leetcode workspace environment.
3
4/// the definition of [`crate::tree::raw_def::TreeNode`] structure and the associated method
5/// [`crate::tree::raw_def::TreeNode::new`].
6pub const TREE_INIT_TEXT: &str = r"// Definition for a binary tree node.
7// #[derive(Debug, PartialEq, Eq)]
8// pub struct TreeNode {
9//   pub val: i32,
10//   pub left: Option<Rc<RefCell<TreeNode>>>,
11//   pub right: Option<Rc<RefCell<TreeNode>>>,
12// }
13//
14// impl TreeNode {
15//   #[inline]
16//   pub fn new(val: i32) -> Self {
17//     TreeNode {
18//       val,
19//       left: None,
20//       right: None
21//     }
22//   }
23// }
24use std::rc::Rc;
25use std::cell::RefCell;";
26
27/// Easy-to-input typedef of some tedious, but also useful structures
28pub const TREE_SHORTCUTS_TEXT: &str = r"type TreeHandle = Option<Rc<RefCell<TreeNode>>>;
29type ORRT = Option<Rc<RefCell<TreeNode>>>;
30type RRT = Rc<RefCell<TreeNode>>;
31type RT = RefCell<TreeNode>;";