pub struct BindingRemapTable { /* private fields */ }Expand description
Maps compact 20-bit indices ↔ full NodeSchemaBinding values.
Index 0 is an unbound sentinel (returned as None by get)
and is never stored in the entries list.
Implementations§
Source§impl BindingRemapTable
impl BindingRemapTable
Sourcepub fn register(
&mut self,
binding: NodeSchemaBinding,
) -> Result<u32, BufferDocumentError>
pub fn register( &mut self, binding: NodeSchemaBinding, ) -> Result<u32, BufferDocumentError>
Registers a NodeSchemaBinding and returns its 20-bit index.
If an identical binding was already registered, returns the existing index. Uses linear scan for deduplication (expected table size is small).
Returns BufferDocumentError::Overflow if the table would exceed 2^20 − 1 entries.
Sourcepub fn get(&self, idx: u32) -> Option<&NodeSchemaBinding>
pub fn get(&self, idx: u32) -> Option<&NodeSchemaBinding>
Returns the NodeSchemaBinding for the given index, or None for index 0.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BindingRemapTable
impl RefUnwindSafe for BindingRemapTable
impl Send for BindingRemapTable
impl Sync for BindingRemapTable
impl Unpin for BindingRemapTable
impl UnsafeUnpin for BindingRemapTable
impl UnwindSafe for BindingRemapTable
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