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 = tree.first().and_then(|n| n.into_node()).ok_or("missing root")?;
let root2 = tree.last().and_then(|n| n.into_node()).ok_or("missing root")?;
let root1: <u32 as Width>::Pointer = root1.id();
let root2: <u32 as Width>::Pointer = root2.id();
assert_ne!(root1, root2);
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".