Skip to main content

ConversionCommands

Enum ConversionCommands 

Source
pub enum ConversionCommands {
    ToJson {
        file: String,
        output: Option<String>,
        metadata: bool,
        pretty: bool,
    },
    FromJson {
        file: String,
        output: Option<String>,
    },
    ToYaml {
        file: String,
        output: Option<String>,
    },
    FromYaml {
        file: String,
        output: Option<String>,
    },
    ToXml {
        file: String,
        output: Option<String>,
        pretty: bool,
    },
    FromXml {
        file: String,
        output: Option<String>,
    },
    ToCsv {
        file: String,
        output: Option<String>,
        headers: bool,
    },
    FromCsv {
        file: String,
        output: Option<String>,
        type_name: String,
    },
    ToParquet {
        file: String,
        output: String,
    },
    FromParquet {
        file: String,
        output: Option<String>,
    },
    ToToon {
        file: String,
        output: Option<String>,
    },
    FromToon {
        file: String,
        output: Option<String>,
    },
}
Expand description

Format conversion commands.

These commands enable bidirectional conversion between HEDL and various data formats, making HEDL interoperable with existing tools and workflows.

§Supported Formats

  • JSON: Compact and pretty printing, optional metadata
  • YAML: Standard YAML format
  • XML: Compact and pretty printing
  • CSV: Tabular data with optional headers
  • Parquet: Apache Parquet columnar format

§Design

All conversion commands follow a consistent pattern:

  • to-<format>: Convert HEDL to target format
  • from-<format>: Convert target format to HEDL

Variants§

§

ToJson

Convert HEDL to JSON

Converts a HEDL file to JSON format with optional pretty printing and metadata inclusion.

Fields

§file: String

Input HEDL file

§output: Option<String>

Output file path (defaults to stdout)

§metadata: bool

Include HEDL metadata in JSON

§pretty: bool

Pretty print JSON

§

FromJson

Convert JSON to HEDL

Converts a JSON file to HEDL format. Foreign key relationships are automatically detected and converted to nested hierarchies.

Fields

§file: String

Input JSON file

§output: Option<String>

Output file path (defaults to stdout)

§

ToYaml

Convert HEDL to YAML

Converts a HEDL file to YAML format.

Fields

§file: String

Input HEDL file

§output: Option<String>

Output file path (defaults to stdout)

§

FromYaml

Convert YAML to HEDL

Converts a YAML file to HEDL format.

Fields

§file: String

Input YAML file

§output: Option<String>

Output file path (defaults to stdout)

§

ToXml

Convert HEDL to XML

Converts a HEDL file to XML format with optional pretty printing.

Fields

§file: String

Input HEDL file

§output: Option<String>

Output file path (defaults to stdout)

§pretty: bool

Pretty print XML

§

FromXml

Convert XML to HEDL

Converts an XML file to HEDL format.

Fields

§file: String

Input XML file

§output: Option<String>

Output file path (defaults to stdout)

§

ToCsv

Convert HEDL to CSV

Converts a HEDL file containing tabular data to CSV format. Works best with HEDL matrix lists.

Fields

§file: String

Input HEDL file

§output: Option<String>

Output file path (defaults to stdout)

§headers: bool

Include header row

§

FromCsv

Convert CSV to HEDL

Converts a CSV file to HEDL matrix list format.

Fields

§file: String

Input CSV file

§output: Option<String>

Output file path (defaults to stdout)

§type_name: String

Type name for the matrix list

§

ToParquet

Convert HEDL to Parquet

Converts a HEDL file to Apache Parquet columnar format. Requires an output file path (Parquet cannot write to stdout).

Fields

§file: String

Input HEDL file

§output: String

Output Parquet file path (required)

§

FromParquet

Convert Parquet to HEDL

Converts an Apache Parquet file to HEDL format.

Fields

§file: String

Input Parquet file

§output: Option<String>

Output file path (defaults to stdout)

§

ToToon

Convert HEDL to TOON

Converts a HEDL file to TOON format.

Fields

§file: String

Input HEDL file

§output: Option<String>

Output file path (defaults to stdout)

§

FromToon

Convert TOON to HEDL

Converts a TOON file to HEDL format.

Fields

§file: String

Input TOON file

§output: Option<String>

Output file path (defaults to stdout)

Implementations§

Source§

impl ConversionCommands

Source

pub fn execute(self) -> Result<(), CliError>

Execute the conversion command.

§Returns

Returns Ok(()) on success, or an error message on failure.

§Errors

Returns Err if:

  • File I/O fails
  • Parsing fails
  • Conversion fails
  • Output writing fails

Trait Implementations§

Source§

impl FromArgMatches for ConversionCommands

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Subcommand for ConversionCommands

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,