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
impl ShapeTransitionTable
Sourcepub fn get_shape(&self, id: ShapeId) -> &Shape
pub fn get_shape(&self, id: ShapeId) -> &Shape
Get a shape by its ID. Panics if the ID is invalid.
Sourcepub fn transition(&mut self, from: ShapeId, property_name: u32) -> ShapeId
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.
Sourcepub fn shape_for_keys(&mut self, keys: &[u32]) -> ShapeId
pub fn shape_for_keys(&mut self, keys: &[u32]) -> ShapeId
Build a shape by transitioning from root through all keys in order.
Sourcepub fn property_index(
&self,
shape_id: ShapeId,
property_name: u32,
) -> Option<usize>
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.
Sourcepub fn shape_count(&self) -> usize
pub fn shape_count(&self) -> usize
Total number of shapes in the table.
Auto Trait Implementations§
impl Freeze for ShapeTransitionTable
impl RefUnwindSafe for ShapeTransitionTable
impl Send for ShapeTransitionTable
impl Sync for ShapeTransitionTable
impl Unpin for ShapeTransitionTable
impl UnsafeUnpin for ShapeTransitionTable
impl UnwindSafe for ShapeTransitionTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more