1use crate::{tree::Tree, types::NodeId};
2
3pub mod add;
4pub mod bitand;
5pub mod bitor;
6pub mod shl;
7pub mod shr;
8pub mod sub;
9
10pub struct NodeRef<'a> {
12 tree: &'a mut Tree,
13 key: NodeId,
14}
15
16impl<'a> NodeRef<'a> {
17 pub fn new(
18 tree: &'a mut Tree,
19 key: NodeId,
20 ) -> Self {
21 Self { tree, key }
22 }
23}
24
25impl<'a> std::ops::Deref for NodeRef<'a> {
26 type Target = Tree;
27
28 fn deref(&self) -> &Self::Target {
29 self.tree
30 }
31}
32
33impl<'a> std::ops::DerefMut for NodeRef<'a> {
34 fn deref_mut(&mut self) -> &mut Self::Target {
35 self.tree
36 }
37}
38
39pub struct MarkRef<'a> {
41 tree: &'a mut Tree,
42 key: NodeId,
43}
44
45impl<'a> MarkRef<'a> {
46 pub fn new(
47 tree: &'a mut Tree,
48 key: NodeId,
49 ) -> Self {
50 Self { tree, key }
51 }
52}
53
54impl<'a> std::ops::Deref for MarkRef<'a> {
55 type Target = Tree;
56
57 fn deref(&self) -> &Self::Target {
58 self.tree
59 }
60}
61
62impl<'a> std::ops::DerefMut for MarkRef<'a> {
63 fn deref_mut(&mut self) -> &mut Self::Target {
64 self.tree
65 }
66}
67
68pub struct AttrsRef<'a> {
69 tree: &'a mut Tree,
70 key: NodeId,
71}
72
73impl<'a> AttrsRef<'a> {
74 pub fn new(
75 tree: &'a mut Tree,
76 key: NodeId,
77 ) -> Self {
78 Self { tree, key }
79 }
80}
81
82impl<'a> std::ops::Deref for AttrsRef<'a> {
83 type Target = Tree;
84
85 fn deref(&self) -> &Self::Target {
86 self.tree
87 }
88}
89
90impl<'a> std::ops::DerefMut for AttrsRef<'a> {
91 fn deref_mut(&mut self) -> &mut Self::Target {
92 self.tree
93 }
94}