syntree::pointer

Trait Width

Source
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§

Source

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.

Implementations on Foreign Types§

Source§

impl Width for u8

Source§

impl Width for u16

Source§

impl Width for u32

Source§

impl Width for u64

Source§

impl Width for u128

Source§

impl Width for usize

Implementors§