is_tree/traits/
has_parent.rs1use crate::KnowsVisitor;
4
5pub trait HasParent: KnowsVisitor {
7 fn parent(&self) -> Option<Self::Visitor>;
9}
10
11pub unsafe trait HasParentMut: KnowsVisitor {
14 unsafe fn parent_mut(&mut self) -> Option<Self::VisitorMut>;
16}
17
18impl<T> HasParent for Box<T>
19where T: HasParent
20{
21 fn parent(&self) -> Option<Self::Visitor> {
22 self.as_ref().parent()
23 }
24}
25
26unsafe impl<T> HasParentMut for Box<T>
27where T: HasParentMut
28{
29 unsafe fn parent_mut(&mut self) -> Option<Self::VisitorMut> {
30 self.as_mut().parent_mut()
31 }
32}