pub trait Width: Sealed {
type Pointer: Pointer;
}
Expand description
A pointer width that can be used to reference other nodes.
This is determined by a primitive unsigned types such as u32
or usize
.
Required Associated Types§
Sourcetype Pointer: Pointer
type Pointer: Pointer
The pointer type associated with a specific width.
§Examples
use syntree::pointer::Width;
let tree = syntree::tree! {
"root1",
"root2",
};
let root1: <usize as Width>::Pointer = tree.first().ok_or("missing root")?.id();
let root2: <usize as Width>::Pointer = tree.last().ok_or("missing root")?.id();
assert_ne!(root1, root2);
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.