Crate ifc_lite_core

Crate ifc_lite_core 

Source
Expand description

§IFC-Lite Core Parser

High-performance STEP/IFC parser built with nom. Provides zero-copy tokenization and fast entity scanning for IFC files.

§Overview

This crate provides the core parsing functionality for IFC-Lite:

  • STEP Tokenization: Zero-copy parsing of STEP file format
  • Entity Scanning: SIMD-accelerated entity discovery using memchr
  • Lazy Decoding: On-demand attribute parsing for memory efficiency
  • Streaming Parser: Event-based parsing for large files

§Quick Start

use ifc_lite_core::{EntityScanner, parse_entity, IfcType};

// Scan for entities
let content = r#"#1=IFCPROJECT('guid',$,$,$,$,$,$,$,$);"#;
let mut scanner = EntityScanner::new(content);

while let Some((id, type_name, start, end)) = scanner.next_entity() {
    println!("Found entity #{}: {}", id, type_name);
}

// Parse individual entity
let input = "#123=IFCWALL('guid',$,$,$,$,$,$,$);";
let (id, ifc_type, attrs) = parse_entity(input).unwrap();
assert_eq!(ifc_type, IfcType::IfcWall);

§Streaming Parser

For large files, use the streaming parser to process entities in batches:

use ifc_lite_core::{parse_stream, StreamConfig, ParseEvent};

let config = StreamConfig::default();
for event in parse_stream(content, config) {
    match event {
        ParseEvent::Entity { id, type_name, .. } => {
            println!("Entity #{}: {}", id, type_name);
        }
        ParseEvent::Progress { percent, .. } => {
            println!("Progress: {:.1}%", percent);
        }
        _ => {}
    }
}

§Performance

  • Tokenization: ~1,259 MB/s throughput
  • Entity scanning: ~650 MB/s with SIMD acceleration
  • Number parsing: 10x faster than std using lexical-core

§Feature Flags

  • serde: Enable serialization support for parsed data

Re-exports§

pub use error::Error;
pub use error::Result;
pub use parser::Token;
pub use parser::EntityScanner;
pub use parser::parse_entity;
pub use schema::IfcType;
pub use schema::has_geometry_by_name;
pub use streaming::ParseEvent;
pub use streaming::StreamConfig;
pub use streaming::parse_stream;
pub use decoder::EntityDecoder;
pub use decoder::EntityIndex;
pub use decoder::build_entity_index;
pub use schema_gen::AttributeValue;
pub use schema_gen::DecodedEntity;
pub use schema_gen::IfcSchema;
pub use schema_gen::GeometryCategory;
pub use schema_gen::ProfileCategory;
pub use georef::GeoReference;
pub use georef::GeoRefExtractor;
pub use georef::RtcOffset;
pub use fast_parse::parse_coordinates_direct;
pub use fast_parse::parse_indices_direct;
pub use fast_parse::should_use_fast_path;
pub use fast_parse::extract_entity_type_name;
pub use fast_parse::extract_first_entity_ref;
pub use fast_parse::extract_entity_refs_from_list;
pub use fast_parse::extract_face_indices_from_entity;
pub use fast_parse::extract_coordinate_list_from_entity;
pub use fast_parse::process_triangulated_faceset_direct;
pub use fast_parse::FastMeshData;

Modules§

decoder
Entity Decoder - On-demand entity parsing
error
fast_parse
Fast Direct Parsing Module
generated
Auto-generated IFC Schema Types
georef
IFC Georeferencing Support
parser
STEP/IFC Parser using nom
schema
IFC Schema Types
schema_gen
IFC Schema - Dynamic type system
streaming
Streaming IFC Parser