1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Traits for objects that have a parent.

/// A trait for objects that have a parent.
pub trait HasParent: Sized {
    /// Gets the parent of the object.
    fn parent(&self) -> Option<Self>;
}

/// A trait for objects that have a parent mutably.
/// By design, accessing a Visitor parent is unsafe.
pub unsafe trait UnsafeHasParent: Sized {
    /// Gets the parent of the object.
    unsafe fn parent_mut(&mut self) -> Option<Self>;
}