unsafe trait NodeRef: Copy {
type Value;
// Required methods
unsafe fn range(self, is_leaf: bool) -> Range<i32> ⓘ;
unsafe fn child(self, idx: i32) -> Option<Self>;
unsafe fn value(self, idx: i32) -> Option<Self::Value>;
}Expand description
Abstraction over shared (&Node<V>) and exclusive (*mut Node<V>) node access.
This trait allows KdIterator to be generic over the borrowing mode, so a single iterator
implementation drives both iter (shared) and iter_mut (exclusive).
§Safety
Implementations must ensure that:
range,child, andvalueuphold the safety preconditions of the underlyingNodemethods (i.e. leaf methods are only called on leaf nodes, and inner methods on inner nodes).- For mutable implementations, the returned value references do not alias.
Required Associated Types§
Required Methods§
Sourceunsafe fn range(self, is_leaf: bool) -> Range<i32> ⓘ
unsafe fn range(self, is_leaf: bool) -> Range<i32> ⓘ
Returns the range of indices for this node.
§Safety
is_leaf must correctly indicate whether this is a leaf node.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.