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