Expand description
Rust access library to read/write iChen® 4 Open Protocol™ messages.
Details on the protocol can be found in this document.
§Design Notes
Beware that all data types defined in this crate use borrowed string slices (i.e. &str
) extensively.
This is because the most common usage pattern is to create a data variable, set fields, immediately
serialize it into JSON, then dispose of the data variable. The deserialization story is similar.
Error values also borrow heavily from the input fields as these errors are expected to be handled as soon as possible.
The result is minimal allocations and copying, but at the cost of stricter lifetime management, especially when deserializing – the message struct cannot out-live the original JSON text string as fields are borrowed extensively from the original JSON string.
Another implication due to extensive usage of borrowed string slices is that string literals with
escape sequences will cause parsing errors because the actual string cannot be simply borrowed from
the original JSON string. Luckily this is extremely rare for most fields holding names, ID’s etc.
For this reason, only certain user-defined text fields (such as job_card_id
) may contain
escaped characters (especially the double-quote); those are therefore modeled using Cow<&str>
instead.
Structs§
- ActionID
- A 32-bit ID that represents a controller action.
- Controller
- A data structure containing the current known status of a controller.
- Filters
- General authorizations to access the iChen System via Open Protocol.
- GeoLocation
- A data structure containing a single physical geo-location.
- ID
- A 32-bit numeric ID that cannot be zero or negative.
- JobCard
- A data structure containing information on a production job (i.e. a job card).
- KeyValue
Pair - A general data structure holding a key and value pair.
- Message
Options - Common options of an Open Protocol message.
- Operator
- A data structure containing information on a single user on the system.
- State
Values - A data structure containing a snapshot of the current known states of the controller.
Enums§
- Address
- A data structure holding a controller’s physical address.
- JobMode
- Job modes of the controller.
- Language
- Supported UI languages for the controller’s HMI.
- Message
- All Open Protocol message types.
- OpMode
- Operating modes of the controller.
- Open
Protocol Error - Result error type.
Type Aliases§
- Error
- Result error type.
- R32
- 32-bit real floating-point number.
A floating point number behaving like
f32
that does not allow NaN or +/- Infinity. - Result
- Result type.
- TextID
- A text string ID that cannot be empty or all-whitespace, and must be all-ASCII.
- Text
Name - A
Cow<str>
for a name that cannot be empty or all-whitespace.