openEHR API implementation in Rust

I agree with @thomas.beale about the lack of inheritance in Rust. Java has polymorphism. Dart doesn’t so I used single inheritance with implements:

class Template extends AuthoredArchetype implements Serializable {
class AuthoredArchetype extends Archetype implements AuthoredResource, Serializable {
class Archetype implements Serializable {
abstract class AuthoredResource extends Object implements Serializable {

Archie (Java) implements this as:

public class Template extends AuthoredArchetype {
public class AuthoredArchetype extends Archetype {
public class Archetype extends AuthoredResource {
public abstract class AuthoredResource extends ArchetypeModelObject {
public abstract class ArchetypeModelObject extends OpenEHRBase implements Serializable, Cloneable {

@pintariching Can you please write how Rust would handle this (so that Thomas and I learn a bit about Rust :blush:). This example doesn’t use polymorphism.


I personally like Dart but I wonder if TypeScript would be a better option :thinking:
At least to help web developers work with openEHR without learning it (TypeScript could also be used for the backend but there are many other options on the server-side).
(Dart already has a Dart → JavaScript compiler which I used to create a JavaScript SDK for openEHR)

@pintariching I have to suggest that you generate your AM/RM classes in Rust.
There are different release versions of AM/RM and your app/server must work with many different versions (you cannot control which version another hospital is using to send data to your openEHR CDR).
openEHR uses BMM files to specify the AM/RM models. They can be used by your generator to write 100s of required classes for you :wink: