pub struct Schema {
pub version: String,
pub metadata: Metadata,
pub bit_order: BitOrder,
pub conditional_offsets: Vec<ConditionalOffset>,
pub analysis: AnalysisConfig,
pub root: Group,
}
Expand description
Represents the complete schema configuration for a bit-packed structure to analyze.
The schema defines the layout and structure of the bit-packed data format. It includes versioning, metadata, bit order configuration, and the root group definition.
§Examples
use struct_compression_analyzer::schema::Schema;
use std::path::Path;
let schema = Schema::load_from_file(Path::new("schema.yaml")).unwrap();
Fields§
§version: String
Schema version. Currently only 1.0
is supported
metadata: Metadata
Contains user-provided metadata about the schema
bit_order: BitOrder
Determines whether the bytes are read from the most significant bit (MSB) or least significant bit (LSB) first.
Msb
: First bit is the high bit (7)Lsb
: First bit is the low bit (0)
conditional_offsets: Vec<ConditionalOffset>
Conditional offsets for the schema
analysis: AnalysisConfig
Configuration for analysis operations and output grouping
root: Group
The root group of the schema
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn from_yaml(content: &str) -> Result<Self, SchemaError>
pub fn from_yaml(content: &str) -> Result<Self, SchemaError>
Sourcepub fn load_from_file(path: &Path) -> Result<Self, SchemaError>
pub fn load_from_file(path: &Path) -> Result<Self, SchemaError>
Sourcepub fn ordered_field_and_group_paths(&self) -> Vec<String>
pub fn ordered_field_and_group_paths(&self) -> Vec<String>
Collects a list of field (and group) paths in schema order.
§Examples
Given the following schema:
root:
type: group
fields:
header:
type: group
fields:
mode: 2
partition: 4
colors:
type: group
fields:
r:
type: array
field: R
g:
type: array
field: G
b:
type: array
field: B
The resulting field paths would be:
- “header”
- “colors”
- “colors.r”
- “colors.g”
- “colors.b”
§Returns
Vec<String>
- List of field paths in schema order
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnwindSafe for Schema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more