Module schema

Source
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

§Group Component Methods

§Comparison Types

§Group Components

§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:

    • Field: Single field with bit properties
    • Group: Nested group of fields

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

AnalysisConfig
Configuration for analysis operations and output grouping.
CompressionEstimationParams
Parameters for estimating compression size
Condition
Defines a single condition for offset selection
ConditionalOffset
Defines conditional offset selection rules
CustomComparison
Configuration for custom field group comparisons
Field
A single field definition
Group
Group of related fields or components
GroupComponentArray
Reads all values of a single field until end of input. i.e. R0, R0, R0 etc. until all R0 values are read.
GroupComponentField
Read the data from a field, once. This should only be used from within structs.
GroupComponentPadding
Padding bits
This should only be used from within structs.
GroupComponentSkip
Skip a number of bits from a field. This should only be used from within structs.
GroupComponentStruct
Structured group of components
Metadata
Metadata about the schema
Schema
Represents the complete schema configuration for a bit-packed structure to analyze.
SplitComparison
Configuration for comparing field groups

Enums§

BitOrder
Bit ordering specification for field values
FieldDefinition
Allows us to define a nested item as either a field or group
GroupComponent
SchemaError