Skip to main content

ShapeTransitionTable

Struct ShapeTransitionTable 

Source
pub struct ShapeTransitionTable { /* private fields */ }
Expand description

Manages shape creation and transitions.

Thread-safety: This is NOT thread-safe. For multi-threaded use, wrap in a Mutex or use thread-local instances.

Implementations§

Source§

impl ShapeTransitionTable

Source

pub fn new() -> Self

Create a new transition table with a root shape (id=0, no properties).

Source

pub fn root() -> ShapeId

Returns the root shape ID (always ShapeId(0)).

Source

pub fn get_shape(&self, id: ShapeId) -> &Shape

Get a shape by its ID. Panics if the ID is invalid.

Source

pub fn transition(&mut self, from: ShapeId, property_name: u32) -> ShapeId

Transition from from shape by adding property_name.

Returns the existing child shape if the transition already exists, otherwise creates a new shape with the property appended.

Source

pub fn shape_for_keys(&mut self, keys: &[u32]) -> ShapeId

Build a shape by transitioning from root through all keys in order.

Source

pub fn property_index( &self, shape_id: ShapeId, property_name: u32, ) -> Option<usize>

Find the slot index of property_name in the given shape.

Returns None if the property is not part of this shape. O(n) scan of the shape’s properties list.

Source

pub fn shape_count(&self) -> usize

Total number of shapes in the table.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,