pub struct EntityDecoder<'a> { /* private fields */ }Expand description
Lazy entity decoder with caching
Decodes entities on-demand and caches them for reuse. Uses an index for O(1) entity lookup by ID.
Implementations§
Source§impl<'a> EntityDecoder<'a>
impl<'a> EntityDecoder<'a>
Sourcepub fn with_index(
content: &'a str,
index: FxHashMap<u32, (usize, usize)>,
) -> Self
pub fn with_index( content: &'a str, index: FxHashMap<u32, (usize, usize)>, ) -> Self
Create decoder with pre-built index
Sourcepub fn entity_count(&self) -> usize
pub fn entity_count(&self) -> usize
Get entity count
Sourcepub fn decode_by_id(&mut self, id: EntityId) -> Result<Arc<DecodedEntity>>
pub fn decode_by_id(&mut self, id: EntityId) -> Result<Arc<DecodedEntity>>
Decode entity by ID
Sourcepub fn raw_bytes(&self, id: EntityId) -> Option<&'a [u8]>
pub fn raw_bytes(&self, id: EntityId) -> Option<&'a [u8]>
Get raw bytes for an entity (for fast parsing)
Sourcepub fn unit_scale(&self) -> Option<f64>
pub fn unit_scale(&self) -> Option<f64>
Get cached unit scale
Sourcepub fn set_unit_scale(&mut self, scale: f64)
pub fn set_unit_scale(&mut self, scale: f64)
Set unit scale (called after extraction)
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the cache
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Get cache size
Sourcepub fn find_by_type(&mut self, type_name: &str) -> Vec<Arc<DecodedEntity>>
pub fn find_by_type(&mut self, type_name: &str) -> Vec<Arc<DecodedEntity>>
Find entities by type name
Auto Trait Implementations§
impl<'a> Freeze for EntityDecoder<'a>
impl<'a> RefUnwindSafe for EntityDecoder<'a>
impl<'a> Send for EntityDecoder<'a>
impl<'a> Sync for EntityDecoder<'a>
impl<'a> Unpin for EntityDecoder<'a>
impl<'a> UnsafeUnpin for EntityDecoder<'a>
impl<'a> UnwindSafe for EntityDecoder<'a>
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