Skip to main content

EntityDecoder

Struct EntityDecoder 

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

Source

pub fn new(content: &'a str) -> Self

Create a new decoder for the given content

Source

pub fn with_index( content: &'a str, index: FxHashMap<u32, (usize, usize)>, ) -> Self

Create decoder with pre-built index

Source

pub fn content(&self) -> &'a str

Get raw content

Source

pub fn index(&self) -> &FxHashMap<u32, (usize, usize)>

Get entity index

Source

pub fn all_ids(&self) -> Vec<EntityId>

Get all entity IDs

Source

pub fn entity_count(&self) -> usize

Get entity count

Source

pub fn exists(&self, id: EntityId) -> bool

Check if entity exists

Source

pub fn decode_by_id(&mut self, id: EntityId) -> Result<Arc<DecodedEntity>>

Decode entity by ID

Source

pub fn raw_bytes(&self, id: EntityId) -> Option<&'a [u8]>

Get raw bytes for an entity (for fast parsing)

Source

pub fn raw_str(&self, id: EntityId) -> Option<&'a str>

Get raw string for an entity

Source

pub fn unit_scale(&self) -> Option<f64>

Get cached unit scale

Source

pub fn set_unit_scale(&mut self, scale: f64)

Set unit scale (called after extraction)

Source

pub fn clear_cache(&mut self)

Clear the cache

Source

pub fn cache_size(&self) -> usize

Get cache size

Source

pub fn preload(&mut self, ids: &[EntityId])

Pre-warm cache with specific entities

Source

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> 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.