Skip to main content

API Model

We wrote our core library in idiomatic Rust without any concern for how it would be bound into other languages. Consequently, keep in mind that the Rust API won't always correlate 100% with the various binding APIs. This guide is still helpful for Rust users, but you should be aware that the guide is primarily written from the perspective of the bindings.

Generic Terminology

The guide uses generic terms like struct, interface, and class. Because these terms don't map directly to all languages, please refer to our language-specific pages for information on how these abstract concepts map to language-specific implementations.

note

For example, Rust doesn't support inheritance, which means it lacks an interface concept like C# and Java. Rust users can assume that we're talking about a Box<dyn Trait> whenever we talk about an interface.

Model

We use a binding generator called oo_bindgen to produce idiomatic bindings for all of our protocol libraries. You can read more about our approach to binding generation in this blog post.

Using a Rust API, we model the following constructs and their documentation:

  • Native functions
  • Native structs
  • Constants
  • Abstract interfaces
  • Iterators
  • Classes
    • Constructor/destructor
    • Static methods
    • Instance methods
    • Asynchronous methods

Language-specific code generators consume the model produced by this API to produce idiomatic bindings for each language.

Diagram

JavaTCPUDPTLSSerial.NETC++C APIGenerated from modelRustDNP3Async Runtime