Crate basyx_rs[][src]

Expand description

A Rust library to work with Asset Administration Shells (AAS)

Examples

Creating a Submodel and Serialize to JSON

use basyx_rs::prelude::*;

let mut property = Property::new(
    "property".into(),
    Some(Value::Boolean(false)),
    DataObjectTypeName::Boolean,
);
property.category = Some(Category::CONSTANT);
property.kind = Some(ModelingKind::Instance);

let sme = SubmodelElement::SMProperty(property);
let submodel = Submodel::new("submodel1".into(), KeyType::IdShort, "i".into(), vec![sme]);

let json = serde_json::to_vec(&submodel)?;
let mut file = std::fs::OpenOptions::new()
    .create(true)
    .write(true)
    .read(true)
    .truncate(true)
    .open(path"submodel1.json")?;
file.write_all(&json)?;

Modules

Structs

Enums