Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ for (const feature in features) {
```

## Rust Definition Package
This package is a Rust crate designed to read and parse Code0 definition files (JSON) from a directory structure. It loads all features, including their data types, flow types, and runtime functions, providing them as idiomatic Rust structs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This package is a Rust crate designed to read and parse Code0 definition files (JSON) from a directory structure. It loads all features, including their data types, flow types, and runtime functions, providing them as idiomatic Rust structs.
This package is a Rust crate designed to read and parse CodeZero definition files (JSON) from a directory structure. It loads all features, including data-types, flow-types, and runtime-functions, providing them as idiomatic Rust structs.


### Package Resources
Create: [code0-definition-reader](https://crates.io/crates/code0-definition-reader) on crates.io

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Crate?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes its called crate

### Install Package
```bash
cargo add code0-definition-reader
Expand All @@ -99,14 +102,23 @@ cargo add code0-definition-reader
### Usage

```rs
use code0_definition_reader::Definition;
use code0_definition_reader::Reader;

let features = Definition::new("./path/to/definitions");
let reader = Reader::configure(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give examples and describe further what each parameter does!

String::new(), // Path required for configure
false, // should_break
Vec::new(), // accepted_features
None // accepted_versions
);

let features = reader.read_features("./path/to/definitions");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might overlooked this in the implementation of the reader but you have already given the reader the path with the constructor. Why then providing the path again if you have already access to the path with self.path?


for feature in features {
let name = feature.name(); //name of the feature (e.g. rest)
let data_types = feature.data_types(); //dataTypes of this feature
let flow_types = feature.flow_types(); //flowTypes of this feature
let functions = feature.runtime_functions(); //runtimeFunctions of this feature
let name = &feature.name; // name of the feature (e.g., http)
let data_types = &feature.data_types; // dataTypes of this feature
let flow_types = &feature.flow_types; // flowTypes of this feature
let functions = &feature.functions; // runtimeFunctions of this feature

println!("Loaded feature: {}", name);
}
```