Expand description
§Bit-Packed Structure Analysis Schema
This module provides a structured way to define and analyze bit-packed data formats.
The schema allows specifying:
- Root structure definition
- Conditional offsets for data alignment
- Analysis configuration for comparing field groupings
§Public API
§Main Types
- Schema: Main schema definition containing root structure and analysis configuration
- Group: Represents a group of fields or nested groups
- FieldDefinition: Defines a field or nested group
- AnalysisConfig: Configuration for analysis operations
§Public Methods
Schema::from_yaml()
: Parse schema from YAML stringSchema::load_from_file()
: Load and parse schema from file path
§Group Component Methods
GroupComponentArray::get_bits()
: Get number of bits to read from field
§Comparison Types
- SplitComparison: Configuration for comparing two field group layouts
- CustomComparison: Configuration for comparing custom field group transformations
§Group Components
- GroupComponent: Enum representing different types of group components
- GroupComponentArray: Array of field values
- GroupComponentStruct: Structured group of components
- GroupComponentPadding: Padding bits
- GroupComponentSkip: Skip bits
§Error Handling
- SchemaError: Error types for schema parsing and validation
§Main Components
-
Schema: The root configuration containing:
- Version
- Metadata
- Root group definition
- Bit order configuration
- Conditional offsets
- Analysis configuration
-
Group: Hierarchical structure representing:
- Group description
- Nested fields/components
- Bit order inheritance
- Skip conditions
-
FieldDefinition: Represents either a:
§Example Usage
use struct_compression_analyzer::schema::*;
use std::path::Path;
let yaml = r#"
version: '1.0'
metadata: { name: Test }
root: { type: group, fields: {} }
"#;
// Load schema from YAML
let schema_from_file = Schema::load_from_file(Path::new("schema.yaml")).unwrap();
let schema_from_str = Schema::from_yaml(&yaml).unwrap();
Structs§
- Analysis
Config - Configuration for analysis operations and output grouping.
- Compression
Estimation Params - Parameters for estimating compression size
- Condition
- Defines a single condition for offset selection
- Conditional
Offset - Defines conditional offset selection rules
- Custom
Comparison - Configuration for custom field group comparisons
- Field
- A single field definition
- Group
- Group of related fields or components
- Group
Component Array - Reads all values of a single field until end of input.
i.e.
R0
,R0
,R0
etc. until all R0 values are read. - Group
Component Field - Read the data from a field, once. This should only be used from within structs.
- Group
Component Padding - Padding bits
This should only be used from within structs. - Group
Component Skip - Skip a number of bits from a field. This should only be used from within structs.
- Group
Component Struct - Structured group of components
- Metadata
- Metadata about the schema
- Schema
- Represents the complete schema configuration for a bit-packed structure to analyze.
- Split
Comparison - Configuration for comparing field groups
Enums§
- BitOrder
- Bit ordering specification for field values
- Field
Definition - Allows us to define a nested item as either a field or group
- Group
Component - Schema
Error