plctag-derive

macros for plctag

crates.io docs build license

Usage

please use it with plctag

With this crate, the macros derive plctag_core::Decode and plctag_core::Encode for you automatically.

Examples

```rust use plctagcore::{RawTag, Result, ValueExt}; use plctagderive::{Decode, Encode};

[derive(Debug, Default, Decode, Encode)]

struct MyUDT { #[tag(offset=0)] a: u32, #[tag(offset=4)] b: u32, }

fn main() { let tag = RawTag::new("make=system&family=library&name=debug&debug=4", 100).unwrap(); let res = tag.read(100); assert!(res.isok()); let udt: MyUDT = tag.getvalue(0).unwrap(); asserteq!(udt.a, 4); asserteq!(udt.b, 0); }

```

License

MIT