EntityDecoder

Struct EntityDecoder 

Source
pub struct EntityDecoder<'a> { /* private fields */ }
Expand description

Entity decoder for lazy parsing - uses Arc for efficient cache sharing

Implementations§

Source§

impl<'a> EntityDecoder<'a>

Source

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

Create new decoder

Source

pub fn with_index(content: &'a str, index: EntityIndex) -> Self

Create decoder with pre-built index (faster for repeated lookups)

Source

pub fn decode_at(&mut self, start: usize, end: usize) -> Result<DecodedEntity>

Decode entity at byte offset Returns cached entity if already decoded

Source

pub fn decode_by_id(&mut self, entity_id: u32) -> Result<DecodedEntity>

Decode entity by ID - O(1) lookup using entity index

Source

pub fn resolve_ref( &mut self, attr: &AttributeValue, ) -> Result<Option<DecodedEntity>>

Resolve entity reference (follow #ID) Returns None for null/derived values

Source

pub fn resolve_ref_list( &mut self, attr: &AttributeValue, ) -> Result<Vec<DecodedEntity>>

Resolve list of entity references

Source

pub fn get_cached(&self, entity_id: u32) -> Option<DecodedEntity>

Get cached entity (without decoding)

Source

pub fn clear_cache(&mut self)

Clear cache to free memory

Source

pub fn cache_size(&self) -> usize

Get cache size

Source

pub fn get_raw_bytes(&mut self, entity_id: u32) -> Option<&'a [u8]>

Get raw bytes for an entity (for direct/fast parsing) Returns the full entity line including type and attributes

Source

pub fn get_raw_content(&mut self, entity_id: u32) -> Option<&'a str>

Get raw content string for an entity

Source

pub fn get_entity_ref_list_fast(&mut self, entity_id: u32) -> Option<Vec<u32>>

Fast extraction of entity reference IDs from a list attribute in raw bytes Useful for getting face list from ClosedShell, bounds from Face, etc. Returns list of entity IDs

Source

pub fn get_polyloop_point_ids_fast( &mut self, entity_id: u32, ) -> Option<Vec<u32>>

Fast extraction of PolyLoop point IDs directly from raw bytes Bypasses full entity decoding for BREP optimization Returns list of entity IDs for CartesianPoints

Source

pub fn get_cartesian_point_fast( &mut self, entity_id: u32, ) -> Option<(f64, f64, f64)>

Fast extraction of CartesianPoint coordinates directly from raw bytes Bypasses full entity decoding for ~3x speedup on BREP-heavy files Returns (x, y, z) as f64 tuple

Source

pub fn get_face_bound_fast( &mut self, entity_id: u32, ) -> Option<(u32, bool, bool)>

Fast extraction of FaceBound info directly from raw bytes Returns (loop_id, orientation, is_outer_bound) Bypasses full entity decoding for BREP optimization

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