Skip to content

Commit

Permalink
Merge pull request #9 from bieli/fix-warning-update-readme
Browse files Browse the repository at this point in the history
update README + fix warning from CI logs
  • Loading branch information
bieli authored Mar 2, 2024
2 parents 5be1fb8 + 14b8d60 commit 97cd119
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
[package]
name = "iotext_rs"
version = "0.1.0"
authors = ["Marcin Bielak <[email protected]>"]
edition = "2021"

[lib]
name = "iotext_rs"
path = "src/lib.rs"

[[bin]]
name = "iotext_rs_main"
path = "src/main.rs"


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand All @@ -15,3 +25,4 @@ criterion = "0.3"
[[bench]]
name = "my_benchmark"
harness = false

22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,27 @@ This project was written in `RUST language` and it is an implementation of IoTex
IoText data protocol specification is here: https://github.com/bieli/IoText-data-protocol


# Development STDOUT (parsing IoText data protocol from String)
## Development STDOUT (parsing IoText data protocol from String)


### Example library usage code (parse String with IoText row and prepare String from IoText row)

```rust
use std::*;

use iotext_rs::*;

pub const MSG_EXAMPLE: &str = "t|3900237526042,d|device_name_001,m|val_water_001=i:1234,m|val_water_002=i:15,m|bulb_state=b:1,m|connector_state=b:0,m|temp_01=d:34.4,m|temp_02=d:36.4,m|temp_03=d:10.4,m|pwr=d:12.231,m|current=d:1.429,m|current_battery=d:1.548,m|status_txt=t:in_progress";

fn main() {
let data_obj = IoTextDataRow::default();
let iotext_data_row = data_obj.parse_iotext_str(MSG_EXAMPLE);
println!("iotext_data_row: {:#?}", iotext_data_row);

let str_from_iotext_data: String = data_obj.dump_iotext_to_str(&iotext_data_row);
println!("str_from_iotext_data: {}", str_from_iotext_data)
}
```

### Input example IoText data row
```bash
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use rust_decimal::prelude::*;
use rust_decimal::Decimal;
use std::fmt::Display;
use std::*;

Expand Down

0 comments on commit 97cd119

Please sign in to comment.